memcached - redis或memcache缓存操作类封装有哪些点需要注意?
習慣沉默
習慣沉默 2017-04-26 09:02:05
0
1
721

新公司在用lumen重构做微服务api框架,上面安排在lumen原有基础上再封装一套缓存操作的类库,想问问这方面有什么需要注意的.

目前架构师给的建议有
未连接上redis或者memcache时取真实数据
get获取缓存时候检测是否缓存中存在改key
set时在设置有效时长基础上随机+1-10秒

習慣沉默
習慣沉默

reply all(1)
滿天的星座

The most important thing is to ensure the unity of cache and real data.
If the read cache misses, read the real data, read and write to the cache
Write/delete/modify the real data first, and then operate the cache after success.

The operations of cache and real data must be consistent. Read-write locks can be used to control the problem of old data being acquired by the cache during the period after the real data is operated on.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!