2017 © Pedro Peláez
 

library lrucache

LRU cache server

image

bybzmt/lrucache

LRU cache server

  • Tuesday, January 17, 2017
  • by bybzmt
  • Repository
  • 1 Watchers
  • 1 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

LRUCache

这是一个使用LRU算法的cache服务 (LRU是指最后使用缓存), (*1)

cache中分不同的分组,每个分组有自己的容量和LRU维护, (*2)

每次对指定key的数字进行写操作时,就会把这个key添加到 链表的开头。如果保存的key的个数达到上限,则会把链表尾的key给删除。, (*3)

访问的方式为http请求 . 参数可以接受GET或POST方式 反回JSON {err:0, data:data}, (*4)

错误类型: * 0 成功 * 1 错误, 非特定错误 * 2 分组不存在 * 3 key不存在 * 4 key己存在, (*5)

各请求url介绍

累加

/counter/incr 给指定key增加N,如果key不存在默认为0, (*6)

参数: * group 分组名 * key 键名 * val 数值, (*7)

取出数值最大的的N个key

/counter/hot, (*8)

参数: * group 分组名 * len 取出的key的个数, (*9)

设置指定的key

/cache/set, (*10)

参数: * group 分组名 * key 键名 * val 数值, (*11)

取得指定的key的值

/cache/get, (*12)

参数: * group 分组名 * key 键名, (*13)

删除指定的key

/cache/del, (*14)

参数: * group 分组名 * key 键名, (*15)

创建一个分组

/group/create, (*16)

参数: * group 分组名 * cap 分组容量 * expire 过期时间 * saveTick 定时保存同期,0 不定时保存 * statusTick 定时统状态同期,0 不统计, (*17)

删除一个分组

/group/del, (*18)

参数 * group 分组名, (*19)

同时请求多个

/multiple/ 这个地址再接上面的, 如 /multiple/cache/get 参数是, (*20)

$data = array();
//参数与上面的一至
$data[] = array('group'=>'group1', 'key'=>'key1');
$data[] = array('group'=>'group2', 'key'=>'key2');
reqs = json_encode($data)

程序会返回一个与请求数量一样至的一个数组,里面是每个请求的反回

The Versions

17/01 2017

dev-master

9999999-dev http://github.com/bybzmt/lrucache

LRU cache server

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.0

 

lru lrucache

17/01 2017

v1.0.3

1.0.3.0 http://github.com/bybzmt/lrucache

LRU cache server

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.0

 

lru lrucache

16/01 2017

v1.0.2

1.0.2.0 http://github.com/bybzmt/lrucache

LRU cache server

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.0

 

lru lrucache

01/09 2016

v1.0.1

1.0.1.0 http://github.com/bybzmt/lrucache

LRU cache server

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.0

 

lru lrucache

14/08 2016

v1.0.0

1.0.0.0 http://github.com/bybzmt/lrucache

LRU cache server

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.0

 

lru lrucache