Using the Key Value Pair store - serverboy/Interchange GitHub Wiki
To use the key-value pair storage helper, simply reference the $keyval
object that has been instantiated.
→get($name)
Returns the value of the key specified via $name
. This value should be a string.
→set($name, $value)
Sets the value of the key specified via $name
to the data stored in $value
. The value being set should be a string.
→destroy($name)
Deletes the key specified via $name
.
By default, Interchange includes a driver for both Memcache and Memcached (PECL extensions), as well as a JSON-based raw file store. The driver used can be changed by setting the IXG_KV_STORAGE
.
Create a PHP file in the /helpers/keyval/
directory of your installation. It should be named in the style of your_drivers_name.php
. In this file, create a class named your_drivers_name_driver
. This class should implement the above interface. You are free to use constructors, though destructors may prove to be troublesome.
To activate your driver, simply reference it with IXG_KV_STORAGE
by setting its value to your_drivers_name
.