2017 © Pedro Peláez
 

library cache-store

provides a generic way to cache any data

image

snakano/cache-store

provides a generic way to cache any data

  • Saturday, January 16, 2016
  • by SNakano
  • Repository
  • 3 Watchers
  • 9 Stars
  • 19,657 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 9 Forks
  • 0 Open issues
  • 14 Versions
  • 3 % Grown

The README.md

DominoCacheStore

Build Status Latest Stable Version Total Downloads License, (*1)

provides a generic way to cache any data., (*2)

  • It provide common interface for cache library.
  • support cache library APC, memcached and Redis.
  • support namespace. (use namespace delete)

Install

using Composer(recommended):, (*3)

{
    "require": {
        "snakano/cache-store": "1.*"
    }
}

or cloning this repository., (*4)

Usage

// configure cache setting.
Domino\CacheStore\Factory::setOptions(
    array(
        array(
            'storage'     => 'apc'
            'default_ttl' => 360
        ),
        array(
            'storage'     => 'memcached',
            'prefix'      => 'domino_test',
            'default_ttl' => 360,
            'servers'     => array(
                array('server1', 11211, 20),
                array('server2', 11211, 80)
            )
        ),
        array(
            'storage'     => 'redis',
            'prefix'      => 'domino_test',
            'host'        => '127.0.0.1',
            'port'        => 6379,
            'default_ttl' => 360
        )
    )
);

// factory cache storage
$storage = Domino\CacheStore\Factory::factory('memcached');

// register custom cache storage
$storage = Domino\CacheStore\Factory::registerStorage('acme_storage', 'Acme\Storage\AcmeStorage');

// set data
$storage->set('ns1', 'key1', 'value1');
$storage->set('ns1', 'key2', 'value2');
$storage->set('ns2', 'key1', 'value1');
$storage->set('ns2', 'key2', 'value2', 10); // specify ttl

// get data
$storage->get('ns1', 'key1');
# => 'value1'

// delete by namespace and key
$storage->clear("ns1", 'key1');
$storage->get('ns1', 'key1');
# => null

// delete by namespace
$storage->clearByNamespace('ns1');
$storage->get('ns1', 'key2');
# => null
$storage->get('ns2', 'key1');
# => 'value1'

// delete all
$storage->clearAll();
$storage->get('ns2', 'key1');
# => null

// disable caching at runtime
Domino\CacheStore\Factory::disableCaching();
// since caching is disabled, the factory will return an instance of "NoCache"
$storage = Domino\CacheStore\Factory::factory('memcached');

// enable caching at runtime
Domino\CacheStore\Factory::enableCaching();
// since caching is enabled again, the factory will return an instance of "Memcached"
$storage = Domino\CacheStore\Factory::factory('memcached');

License

MIT license., (*5)

The Versions

16/01 2016

dev-master

9999999-dev

provides a generic way to cache any data

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by Shinya Nakano

cache redis apc memcached

16/01 2016

1.5.0

1.5.0.0

provides a generic way to cache any data

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by Shinya Nakano

cache redis apc memcached

05/02 2015

1.4.2

1.4.2.0

provides a generic way to cache any data

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

by Shinya Nakano

cache redis apc memcached

23/01 2015

1.4.1

1.4.1.0

provides a generic way to cache any data

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

by Shinya Nakano

cache apc memcached

16/06 2014

1.4.0

1.4.0.0

provides a generic way to cache any data

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

by Shinya Nakano

cache apc memcached

26/04 2014

1.3.2

1.3.2.0

provides a generic way to cache any data

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

by Shinya Nakano

cache apc memcached

26/04 2014

1.3.1

1.3.1.0

provides a generic way to cache any data

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

by Shinya Nakano

cache apc memcached

24/02 2014

1.3.0

1.3.0.0

provides a generic way to cache any data

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

by Shinya Nakano

cache apc memcached

16/12 2013

1.2.0

1.2.0.0

A Propel ORM behavior that provide auto data caching to your model.

  Sources   Download

MIT

The Requires

 

by Shinya Nakano

cache behavior propel

14/11 2013

1.1.1

1.1.1.0

propel data cache behavior

  Sources   Download

MIT

The Requires

 

by Shinya Nakano

cache behavior propel

31/08 2013

1.1.0

1.1.0.0

provides a generic way to cache any data

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

by Shinya Nakano

cache apc memcached

09/08 2013

1.0.2

1.0.2.0

propel data cache behavior

  Sources   Download

MIT

The Requires

 

by Shinya Nakano

cache behavior propel

09/06 2013

1.0.1

1.0.1.0

propel data cache behavior

  Sources   Download

MIT

The Requires

 

by Shinya Nakano

cache behavior propel

18/05 2013

1.0.0

1.0.0.0

provides a generic way to cache any data

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

by Shinya Nakano

cache apc memcached