Skip to content

msonnabaum/KeyValueStore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Key/Value Store Component

KeyValueStore is an abstraction layer for diverse key/value storage engines.

Examples

A simple usage example:

use KeyValueStore\KeyValueStoreFactory;

// Define which collections are handled by which storage implementations.
$info = array(
  'cache.boot' => 'KeyValueStore\Storage\MemcachedStorage',
  'cache' => 'KeyValueStore\Storage\RedisStorage',
  'default' => 'KeyValueStore\Storage\SqlStorage',
);
$factory = new KeyValueStoreFactory($info);

// This selects 'cache', since 'cache.common' is not specified.
$storage = $factory->get('cache.common');

// Store something.
$storage->set('foo', 'bar');
// Get it back.
$storage->get('foo');

// Store multiple key/value pairs.
$storage->setMultiple(array(
  'bar' => 'baz',
));

// Get everything.
$storage->getAll();

Tests

To run the unit tests, install dev dependencies before running PHPUnit:

php composer.phar install --dev

Run the unit tests with:

phpunit

About

A generic PHP key-value API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages