Skip to content
This repository has been archived by the owner on Jan 14, 2018. It is now read-only.

Add to Cache callback #75

Closed
chrisjenx opened this issue Mar 27, 2013 · 5 comments
Closed

Add to Cache callback #75

chrisjenx opened this issue Mar 27, 2013 · 5 comments

Comments

@chrisjenx
Copy link

So this might seem a bit of a weird one, but we use robo spice very restfully, but what would be nice is if we could push a response into another cache key.

This makes sense where A response from two or three responses returns a response with a updated version of another request.

so something like:

mSpiceManager.addDataToCache(TaskResponse.class, mResponse, DurationInMillis.ONE_MINUTE ,mCacheKey);

I would quite like this, I understand its no a high priority for you so I will look at implementing it.

If we could agree how this 'should' work then I can go an implement it.

@stephanenicolas
Copy link
Owner

Hi Christopher,

that feature could be interesting. I suggest the method would have a signature like :

mSpiceManager.addDataToCache(TaskResponse.class, mCacheKey, mResponse);

as you don't need any cache duration when adding something to cache. Cache duration is only used to consider whether something read from cache is expired or not.

I believe that an easy way to add this feature would be to add a request through the spice manager. This request wouldn't actually perform any network call, but simply return the response in its load data from network method. The request would be configured not to read from cache (using param ALWAYS_EXPIRED with execute method).

What do you think of this implementation idea ?

And definitly yes, we would be happy of such a contribution, plus testing.

@stephanenicolas
Copy link
Owner

Hi christopher,

I am actually trying to implement the feature you requested. It happens that our team @octo-online currently needs this feature as well in order to mock a post request inside our current project.

I hope to get it working and pushed and deployed to snapshot repo by the end of the day.

Stéphane

@chrisjenx
Copy link
Author

Fantastic that would be amazing.

I haven't forgotten but it's part of performance improvements for my
current project so I am yet to do it.

Cheers
On 11 May 2013 11:24, "stephanenicolas" [email protected] wrote:

Hi christopher,

I am actually trying to implement the feature you requested. It happens
that our team @octo-online https://github.com/octo-online currently
needs this feature as well in order to mock a post request inside our
current project.

I hope to get it working and pushed and deployed to snapshot repo by the
end of the day.

Stéphane


Reply to this email directly or view it on GitHubhttps://github.com//issues/75#issuecomment-17757667
.

@stephanenicolas
Copy link
Owner

Feature has been added o SpiceManager via methods : addDataToCache.
It will be released in RoboSpice 1.4.2.

A snapshot of 1.4.2 will be deployed within minutes.

@LilPickle3000
Copy link

Pardon the comment on a closed issue--I just want to say this is a good new feature, thanks! I just encountered a need for this as well. In my particular case, the request result contains the key, so I couldn't cache it until after making the first request. This should allow me to addDataToCache in the request listener using the new key.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants