PHP Classes
elePHPant
Icontem

Key-Value Storage: Store and retrieve values on different containers

Recommend this page to a friend!
  Info   View files Documentation   View files View files (26)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2017-12-05 (10 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 104 This week: 5All time: 8,797 This week: 138Up
Version License PHP version Categories
kv_storage 1.0.1MIT/X Consortium ...5PHP 5, Databases, Files and Folders
Description Author

This package can store and retrieve values on different containers.

It provides several classes that can check, store, retrieve, update and delete value for given keys on several types of containers.

Currently it provides container classes for storing data in memory, files, MongoDB databases.

  Performance   Level  
Name: Payam Naderi <contact>
Classes: 9 packages by
Country: Iran Iran
Age: 34
All time rank: 270746 in Iran Iran
Week rank: 22 Up1 in Iran Iran Up
Innovation award
Innovation award
Nominee: 2x

Details

Storage

InMemory Store

// Storage for 'test' Realm.

$s = new InMemoryStore('test');
$s->set('name', 'Payam');
$s->set('family', 'Naderi');

$fullname = $s->getFromKeys(['name', 'family']);
$fullname = StdTravers::of($fullname)
    ->each(function($val, $_ ,$prev) {
        return $prev.= ' '.$val;
    });

print_r($fullname);

FlatFile Store

$s = new FlatFileStore('user_codes');
        
$user_id = 'd5e110k33f';
$s->set($user_id, '1453');
// Without this syntax storage will save given entity when dispatch shutdown.
$s->save(); // force to save current 

> In Next Calls

values can be retrieved.

$s = new FlatFileStore('user_codes');
if ($s->has('d5e110k33f'))
    print_r($s->get('d5e110k33f'));

> Destroy Storage

will destroy storage for given 'user_codes' realm.

$s = new FlatFileStore('user_codes');
$s->destroy();

> Choose Desired Options

Options In under_score with construct

$s = new FlatFileStore('user_codes', ['dir_path' => __DIR__.'/my_user_codes.dat']);
$s->set('key', 'value');

will map to setter methods

$s = new FlatFileStore('user_codes');
$s->setPathDir(__DIR__.'/my_user_codes.dat');
$s->set('key', 'value');

Mongo Store

$client     = \Module\MongoDriver\Actions::Driver()->getClient('master');
$collection = $client->selectCollection('papioniha', 'store.app');

$s = new MongoStore('pass_trough', ['collection' => $collection]);

// Traverse All Data

$v = StdTravers::of( $s )
    ->each(function($val, $key ,$prev) {
        if ( is_array($prev) )
            return $prev[$key] = $val;

        return [$key => $val];
    });

print_r($v);
  Files folder image Files  
File Role Description
Files folder imagesrc (6 files, 6 directories)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file readme.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imageException (4 files, 1 directory)
Files folder imageHttp (2 files)
Files folder imageInterchange (3 files)
Files folder imageInterfaces (2 files)
Files folder imageRedis (2 files)
Files folder imageWrapper (1 file)
  Plain text file aDataStore.php Class Class source
  Plain text file FlatFileStore.php Class Class source
  Plain text file InMemoryStore.php Class Class source
  Plain text file MongoStore.php Class Class source
  Plain text file RedisStore.php Class Class source
  Accessible without login Plain text file _functions.php Aux. Auxiliary script

  Files folder image Files  /  src  /  Exception  
File Role Description
Files folder imageStorage (3 files)
  Plain text file exDataMalformed.php Class Class source
  Plain text file exDataNotPersistable.php Class Class source
  Plain text file exInvalidKey.php Class Class source
  Plain text file exUnknownData.php Class Class source

  Files folder image Files  /  src  /  Exception  /  Storage  
File Role Description
  Plain text file exIOError.php Class Class source
  Plain text file exReadError.php Class Class source
  Plain text file exWriteError.php Class Class source

  Files folder image Files  /  src  /  Http  
File Role Description
  Plain text file CookieStore.php Class Class source
  Plain text file SessionStore.php Class Class source

  Files folder image Files  /  src  /  Interchange  
File Role Description
  Plain text file ExportInterchange.php Class Class source
  Plain text file JsonInterchange.php Class Class source
  Plain text file SerializeInterchange.php Class Class source

  Files folder image Files  /  src  /  Interfaces  
File Role Description
  Plain text file iDataStore.php Class Class source
  Plain text file iInterchangeable.php Class Class source

  Files folder image Files  /  src  /  Redis  
File Role Description
  Plain text file CleanScriptCommand.php Class Class source
  Plain text file CountScriptCommand.php Class Class source

  Files folder image Files  /  src  /  Wrapper  
File Role Description
  Plain text file aWrapperDataStore.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:104
This week:5
All time:8,797
This week:138Up