Project Summary

  Analyzed 8 days ago based on code collected 8 days ago.

可以使得memcachedb有memcached的过期特性! 增加一个计划任务即可

let the memcachedb acts like memcached

memcachedb和memcached的两个主要区别:前者不管理过期,每个存储都是长期有效 前者使用磁盘存储,有广阔的存储空间 这两个优点使得很多缓存的地方可以使用上memcachedb。

本地数据缓存这个带来的最大便利是可以实现数据共享,备份简便,这是本地文件缓存无法比拟的。

网页缓存在Nginx可以使用memcache接口,很简便的实现网页cache

以上两项应用需要解决过期问题方式不同:对于本地数据缓存,可以再保存一个值是当前保存的数据的时间即可。 类似读写文件一样,记录修改时的时间戳

$key=>"http://www.aslibra.com/"
$key."_time"=>time()对于nginx无法判断是否过期的情况,可以实现自动清理,阿权设计方案的是按秒存储数据,定期清理 清理的方法决定了保存的其它数据的方式,你也可以写入文件日志的方式,然后按日志清理 这里用自身的存储,记录相应的数据信息

$key=>"http://www.aslibra.com/"
$key2=>"http://www.aslibra.com/blog/"
$expire_time=>2
$expire_time.'_'.1=>$key
$expire_time.'_'.2=>$key2这个主要在解决$expire_time的自增的问题,细节可以处理此问题 需要用到increment和add,他们都有键值是否存在的问题,根据此功效解决冲突。 先尝试increment,如果成功,说明已经有了,否则可能没有。在没有的情况下,尝试添加此键值,成功说明此时没有同时的进程,否则有同时请求的进程已经在此短暂的不行的时间里添加了,那就再次调用increment即可。

Share

In a Nutshell, memcachedb-manage...

 

Activity

30 Day Summary Apr 12 2013 — May 12 2013

12 Month Summary May 12 2012 — May 12 2013

Community

Ratings

Be the first to rate this project
 
Click to add your rating
 
Review this Project!
 
 
 

Creative Commons License Copyright © 2013 Black Duck Software, Inc. and its contributors, Some Rights Reserved. Unless otherwise marked, this work is licensed under a Creative Commons Attribution 3.0 Unported License . Ohloh ® and the Ohloh logo are trademarks of Black Duck Software, Inc. in the United States and/or other jurisdictions. All other trademarks are the property of their respective holders.