Hi,
Basically, I need some script to cache data other than session in Ratpack, there are two options: 1. Use guava cache or Redis directly, the same way as you did in DefaultMapSessionStore.java. 2. Come up with a GenericCacheStore which could also be used for caching session. Any suggestions from your point of view? Thanks. |
Administrator
|
Since Guava is already a Ratpack dependency, I'd be tempted to use its Cache interface as the basis for what you're doing. It's a decent Cache interface and could be used with a Redis implementation.
I'd create a marker subinterface of this, because Ratpack depenedency injection (through Guice) is based on types. This will make it easier to dependency inject and to context lookup. This is what is happening with SessionStorage. You'd create a Guice module that binds some implementation to this interface. This could be Guava cache backed, or Redis. |
In reply to this post by pz_wang
I was just about to start writing the same thing. Basically need to cache the results from external api calls.
If you've made any progress it would be great if you could share? Thanks Paul |
Administrator
|
I'd recommend just starting with Guava's CacheBuilder.
|
Free forum by Nabble | Edit this page |