Download the PHP package mreschke/keystone without Composer
On this page you can find all versions of the php package mreschke/keystone. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package keystone
Keystone
Keystone is a mrcore Laravel module that provides a key/value store wrapper on top of Redis. PHP values are stored into native redis values (SETS, LISTS, HASHES etc..). These native values provide more speed over basic serialization. Values are returned from redis into proper PHP objects.
Organization and Convention
Keystone is a key/value data store and therefore stores all information using string based keys. These keys are organized into namespaces. Namespaces follow the PHP vendor/package
namespace convention. If no namespace is defined in the cofnig when storing a key, the default namespace of mreschke/foundation
is used. It is up to you to use the proper namespaces when assigning keys. See Proper Key Layouts below for details. Keystone values can be strings
, lists (arrays)
, hashes (associative arrays)
or PHP serialized strings
of any object or item. Because files are strings, keystone can also stores files of any size and type! If a value is above a certain byte limit, the value will be stored as an index file on the filesystem.
It is always best to try to store values as native redis formats, so arrays or associative arrays are best. Only use serialization when necessary as it is a PHP only format.
When storing many similar values such as app/api
configuration information, try to use a single hash
to hold all the values instead of a million individual keys.
Instance
To gain access to keystone via PHP you may use any of these methods. These are in order of preference. Proper PHP code states dependency injection is always the best method.
- Dependency Injection -
public function __construct(Mreschke\Keystone\KeystoneInterface $keystone)
- IoC -
App::make('Mreschke\Keystone')
orApp::make('Mreschke\Keystone\KeystoneInterface')
- Facade -
Mreschke::keystone()->get('mykey')
or$keystone = Mreschke::keystone()
or$keystone = Mreschke::keystone()->getInstance()
When storing values, I do not force or use compression. If you want to compress your data with PHP use gzencode() and gzdecode()
instead of the other gz*
PHP functions. gzencode()
is a unix gzip compatible function so you can view the compressed file using all gz standards like zcat /myfile
or gzunzip /myfile
.
PHP API Usage
CLI Usage
Keystone comes with a laravel console application available at
./artisan keystone
I generally make a bash script in {{/usr/local/bin/keystone}} with
Commands parallel PHP API, so view that documentation above for more detail on these items.