freekrai / notredis
A simple storage class inspired by the redis api on top of Sqlite
Installs: 241
Dependents: 0
Suggesters: 0
Security: 0
Watchers: 1
Open Issues: 0
pkg:composer/freekrai/notredis
Requires
- php: >=5.3.2
This package is not auto-updated.
Last update: 2015-07-01 12:49:57 UTC
README
A simple storage class inspired by the redis api on top of Sqlite.
Really, meant for those times when you want basic data storage, without going through all the work of installing a Redis server.
Usage
$db = new NotRedis\NotRedis( "PATH_TO_WRITABLE_FOLDER/mydb" );
$db->set("mykey", 1);
$db->incr("mykey");
$db->get("mykey"); // 2
// Lists
db->rpush("mylist", "item1");
db->rpush("mylist", "item2");
$db->lpush("mylist", "item3");
$db->get("mylist"); // ["item3", "item1", "item2"]
// hashes
$db->hset("myhash", "myfield", 1);
$db->hmset("myhash", "myfield-1", "value-1", "myfield-2", "value-2");
$db->hkeys("myhash"); // ["myfield", "myfield-1", "myfield-2"]
$db->hvals("myhash"); // [1, "value-1", "value-2"]
$db->hget("myhash", "myfield"); // 1
$db->get("myhash"); // array("myfield"=>1, "myfield-1"=>"value-1", "myfield-2"=>"value-2")
implemented methods
set, get, exists, keys, del, type, incr, decr,
llen, lpush, rpush, lset, lindex,
hset, hget, hgetall, hexists, hkeys, hvals, hlen, hincrby, hmset, hmget