开发者

Spring caching solution with time based data

I'm a 'caching beginner' and I was looking at Spring's alternatives to solve the following requirements:

I have some time based data that is inserted into the database every minute. Once the data is inserted it will never be modified or deleted. Also, data will never be inserted in any days prior to the current one (no insertions '开发者_运维百科in the past').

Users frequently request past data between a starting date and the current one. I would like their requests to be fulfilled by a mixed cache/database solution.

E.G. If an user requests last week of data once a day every day, I would like to access the cache for the first 6 days and the database for the last one. The cache would then be updated and I would have the same behavior the day after.

Is there a way to configure/implement this in a clean way using any of Spring's caching alternatives?

Thank you.


EHCache support all of this and more and it integrates with Spring nicely.

[update] - If I am reading your question right, you need to configure timeToLive and timeToIdle on your cache. All of this is documented in the main configuration page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜