2017 © Pedro Peláez
 

library key-value-store

Key-value store generic package. It contains abstractions.

image

adammbalogh/key-value-store

Key-value store generic package. It contains abstractions.

  • Friday, August 19, 2016
  • by adammbalogh
  • Repository
  • 4 Watchers
  • 47 Stars
  • 6,662 Installations
  • PHP
  • 11 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 13 Versions
  • 17 % Grown

The README.md

Key Value Store

Author Build Status Coverage Status Quality Score Software License Packagist Version Total Downloads, (*1)

SensioLabsInsight, (*2)

Key Value Store is a library which abstracts the most used key value stores, like Redis or Memcached., (*3)

Description

This library provides an abstraction layer for key value stores. It is literally an abstraction because it contains only contracts and fundemantal implementations. So you need to install a store specific implementation a.k.a. an adapter., (*4)

Adapters

These are separate repositories!, (*5)

Adapter name Repository
Memory key-value-store-memory
Shared Memory key-value-store-shared-memory
File key-value-store-file
Memcache key-value-store-memcache
Memcached key-value-store-memcached
Redis key-value-store-redis
Replicator key-value-store-replicator
Null key-value-store-null

Planned adapters

  • Apc
  • Couchbase
  • ?

Installation

This is an abstract package not a store specific implementation., (*6)

Please visit the links in the Adapters section., (*7)

Usage

with Redis (through predis/predis), (*8)

<?php
use AdammBalogh\KeyValueStore\KeyValueStore;
use AdammBalogh\KeyValueStore\Adapter\RedisAdapter as Adapter;
use Predis\Client as RedisClient;

$redisClient = new RedisClient();

$adapter = new Adapter($redisClient);

$kvs = new KeyValueStore($adapter);

$kvs->set('sample_key', 'Sample value');
$kvs->get('sample_key');
$kvs->delete('sample_key');

To see other specific examples please visit the links in the Adapters section., (*9)

API

You can call all of the API methods on a instance of KeyValueStore., (*10)

Key

/**
 * Removes a key.
 *
 * @param string $key
 *
 * @return bool True if the deletion was successful, false if the deletion was unsuccessful.
 *
 * @throws \InvalidArgumentException
 * @throws InternalException
 */
public function delete($key);

/**
 * Sets a key's time to live in seconds.
 *
 * @param string $key
 * @param int $seconds
 *
 * @return bool True if the timeout was set, false if the timeout could not be set.
 *
 * @throws \InvalidArgumentException
 * @throws InternalException
 */
public function expire($key, $seconds);

/**
 * Returns the remaining time to live of a key that has a timeout.
 *
 * @param string $key
 *
 * @return int Ttl in seconds.
 *
 * @throws \InvalidArgumentException
 * @throws KeyNotFoundException
 * @throws InternalException
 */
public function getTtl($key);

/**
 * Determines if a key exists.
 *
 * @param string $key
 *
 * @return bool True if the key does exist, false if the key does not exist.
 *
 * @throws \InvalidArgumentException
 * @throws InternalException
 */
public function has($key);

/**
 * Removes the existing timeout on key, turning the key from volatile (a key with an expire set)
 * to persistent (a key that will never expire as no timeout is associated).
 *
 * @param string $key
 *
 * @return bool True if the persist was success, false if the persis was unsuccessful.
 *
 * @throws \InvalidArgumentException
 * @throws InternalException
 */
public function persist($key);

Value

/**
 * Gets the value of a key.
 *
 * @param string $key
 *
 * @return mixed The value of the key.
 *
 * @throws \InvalidArgumentException
 * @throws KeyNotFoundException
 * @throws InternalException
 */
public function get($key);

/**
 * Sets the value of a key.
 *
 * @param string $key
 * @param mixed $value Can be any of serializable data type.
 *
 * @return bool True if the set was successful, false if it was unsuccessful.
 *
 * @throws \InvalidArgumentException
 * @throws InternalException
 */
public function set($key, $value);

Server

/**
 * Removes all keys.
 *
 * @return void
 *
 * @throws \AdammBalogh\KeyValueStore\Exception\InternalException
 */
public function flush();

Support

Support with Gittip, (*11)

The Versions

19/08 2016

dev-master

9999999-dev

Key-value store generic package. It contains abstractions.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

nosql store key value key-value

19/08 2016

0.5.3

0.5.3.0

Key-value store generic package. It contains abstractions.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

nosql store key value key-value

22/10 2014

0.5.2

0.5.2.0

Key-value store generic package. It contains abstractions.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

nosql store key value key-value

20/10 2014

0.5.1

0.5.1.0

Key-value store generic package. It contains abstractions.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

nosql store key value key-value

16/10 2014

0.5.0

0.5.0.0

Key-value store generic package. It contains abstractions.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

nosql store key value key-value

13/10 2014

0.4.0

0.4.0.0

Key-value store generic package. It contains abstractions.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

nosql store key value key-value

29/09 2014

0.3.3

0.3.3.0

Key-value store generic package. It contains abstractions.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

nosql store key value key-value

27/09 2014

0.3.2

0.3.2.0

Key-value store generic package. It contains abstractions.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

nosql store key value key-value

26/09 2014

0.3.1

0.3.1.0

Key-value store generic package. It contains abstractions.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

nosql store key value key-value

26/09 2014

0.3.0

0.3.0.0

Key-value store generic package. It contains abstractions.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

nosql store key value key-value

25/09 2014

0.2.1

0.2.1.0

Key-value store generic package. It contains abstractions.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

nosql store key value key-value

25/09 2014

0.2.0

0.2.0.0

Key-value store generic package. It contains abstractions.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

nosql store key value key-value

23/09 2014

0.1.0

0.1.0.0

Key-value store generic package. It contains abstractions.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

nosql store key value key-value