Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

to put objects in cache #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

to put objects in cache #8

wants to merge 1 commit into from

Conversation

sytolk
Copy link

@sytolk sytolk commented Aug 13, 2014

I have replace Apache Commons IO dependence with google guava. And have add new public methods:
put(String key, String value, Object[] array) - the value I have use to put the timestamp for max TTL (after this time in ms the cache expired)
and: T getArray(String key, Class type)

You can put array from Serializable objects like this:
cache.put("key", String.valueOf(new Date().getTime() + 60000), Groups[] arrayGroups);

and get it: Groups[] cacheArray = getCacheArray("key", Groups[].class);

private T getCacheArray(String key, Class type) {
try {
if (cache.contains(key)) {
return cache.getArray(key, type);
}
} catch (IOException e) {
Log.e("getCacheEntry", e.getMessage());
}
return null;
}

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

Successfully merging this pull request may close these issues.

1 participant