scrapbook.cash
Transactions · Scrapbook
http://www.scrapbook.cash/extras/transactional-cache
TransactionalStore makes it possible to defer writes to a later point in time. Similar to transactions in databases, all deferred writes can be rolled back or committed all at once to ensure the data that is stored is reliable and complete. All of it will be stored, or nothing at all. You may want to process code throughout your codebase, but not commit it any changes until everything has successfully been validated and written to permanent storage. It too is a KeyValueStore, but adds 3 methods:. Transac...
scrapbook.cash
Adapters · Scrapbook
http://www.scrapbook.cash/adapters
Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering. Redis is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, sorted sets, bitmaps and hyperloglogs. Engineered to meet the elastic scalability, consistent high performance, always-on availability, and data mobility requirements of mission critical applications. PHP can keep data in memory, too!
scrapbook.cash
PSR-16 simplecache · Scrapbook
http://www.scrapbook.cash/interfaces/psr-simplecache
Boilerplate code example with Memcached, but any / MatthiasMullie Scrapbook KeyValueStore adapter will work $client = new Memcached(); $client- addServer('localhost', 11211); $cache = new MatthiasMullie Scrapbook Adapters Memcached($client); / create Simplecache object from cache engine $simplecache = new MatthiasMullie Scrapbook Psr16 SimpleCache($cache); / get value from cache $value = $simplecache- get('key'); / . or store a new value to cache $simplecache- set('key', 'updated-value');. Psr/simplecach...
scrapbook.cash
PostgreSQL · Scrapbook
http://www.scrapbook.cash/adapters/postgresql
Create PDO object pointing to your PostgreSQL server $client = new PDO('pgsql:user=postgres dbname=cache password='); / create Scrapbook KeyValueStore object $cache = new MatthiasMullie Scrapbook Adapters PostgreSQL($client); / set a value $cache- set('key', 'value'); / returns true / get a value $cache- get('key'); / returns 'value'. While a database is not a genuine cache, it can also serve as key-value store. Just don’t expect the same kind of performance you’d expect from a dedicated cache server.
scrapbook.cash
Interfaces · Scrapbook
http://www.scrapbook.cash/interfaces
Scrapbook supports 3 different interfaces. There's the Scrapbook-specific KeyValueStore, and then there are 2 PSR interfaces put forward by the PHP FIG. An interface for typical key-value store functionality inspired by PHP's Memcached API. Implementing this interface in an application means you get support for every backend for free, since all adapters share this exact same implementation.
scrapbook.cash
Key-value store · Scrapbook
http://www.scrapbook.cash/interfaces/key-value-store
Boilerplate code example with Memcached. $client = new Memcached(); $client- addServer('localhost', 11211); / create Scrapbook KeyValueStore object $cache = new MatthiasMullie Scrapbook Adapters Memcached($client); / set a value $cache- set('key', 'value'); / returns true / get a value $cache- get('key'); / returns 'value'. KeyValueStore is the cornerstone of this project. It is the interface that provides the most cache operations:. Get($key, &$token = null): mixed bool. Retrieves an item from the cache.
scrapbook.cash
Redis · Scrapbook
http://www.scrapbook.cash/adapters/redis
Create Redis object pointing to your Redis server $client = new Redis(); $client- connect('127.0.0.1'); / create Scrapbook KeyValueStore object $cache = new MatthiasMullie Scrapbook Adapters Redis($client); / set a value $cache- set('key', 'value'); / returns true / get a value $cache- get('key'); / returns 'value'. The PECL Redis extension. Is used to interface with the Redis server. Just provide a valid. Object to the Redis adapter:. Get($key, &$token = null): mixed bool. Store multiple values at once.
scrapbook.cash
PSR-6 cache · Scrapbook
http://www.scrapbook.cash/interfaces/psr-cache
Boilerplate code example with Memcached, but any / MatthiasMullie Scrapbook KeyValueStore adapter will work $client = new Memcached(); $client- addServer('localhost', 11211); $cache = new MatthiasMullie Scrapbook Adapters Memcached($client); / create Pool object from cache engine $pool = new MatthiasMullie Scrapbook Psr6 Pool($cache); / get item from Pool $item = $pool- getItem('key'); / get item value $value = $item- get(); / . or change the value &. It doesn’t let you do too many operations. If. Sets a...
scrapbook.cash
MySQL · Scrapbook
http://www.scrapbook.cash/adapters/mysql
Create PDO object pointing to your MySQL server $client = new PDO('mysql:dbname=cache;host=127.0.0.1', 'root', ' ); / create Scrapbook KeyValueStore object $cache = new MatthiasMullie Scrapbook Adapters MySQL($client); / set a value $cache- set('key', 'value'); / returns true / get a value $cache- get('key'); / returns 'value'. While a database is not a genuine cache, it can also serve as key-value store. Just don’t expect the same kind of performance you’d expect from a dedicated cache server. Stores a ...
scrapbook.cash
SQLite · Scrapbook
http://www.scrapbook.cash/adapters/sqlite
Create PDO object pointing to your SQLite server $client = new PDO('sqlite:cache.db'); / create Scrapbook KeyValueStore object $cache = new MatthiasMullie Scrapbook Adapters SQLite($client); / set a value $cache- set('key', 'value'); / returns true / get a value $cache- get('key'); / returns 'value'. While a database is not a genuine cache, it can also serve as key-value store. Just don’t expect the same kind of performance you’d expect from a dedicated cache server. Get($key, &$token = null): mixed bool.