Redis cache-miss behavior

Redis缓存命中的行为

问题 (Question)

New to redis and it's full abilities. Currently I have a small web front-end that can determine if the item is in redis cache or not -- if it's not, it fetches the item from S3 and adds to redis cache.

Is there a way I can have Redis actually perform an action (or run a script) on a cache-miss? Ideally I remove this web front-end and have the client (which is actually a REST server) connect directly to redis to retrieve the data (and redis would load the missing data from S3 on a miss) ...

TIA

新的使用和它的充分的能力。目前我有一个小的Web前端,可以确定该项目是否在Redis缓存或不——如果不是的话,它把项目从S3和添加到Redis缓存。

有一个方法可以是实际执行操作(或运行脚本)在高速缓存未命中?我删除此Web前端和客户端(实际上是一个休息的服务器)直接连接到redis来检索数据(以及redis会从S3在错过负载丢失的数据)…

短暂性脑缺血发作

最佳答案 (Best Answer)

Redis doesn't provide that out of the box. However, it is open source so you could add your own logic to it if you really want... go http://github.com/antirez/redis, fork and start coding.

使用不提供这样的框。然而,它是开源的,你可以添加你自己的逻辑,如果你真的想要的话…去http://github.com/antirez/redis叉开始编码。

本文翻译自StackoverFlow,英语好的童鞋可直接参考原文:http://stackoverflow.com/questions/21684230