Skip to content

Instantly share code, notes, and snippets.

@Mistic92
Created February 20, 2018 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mistic92/5043b682aa5742a7d7fad68c7ad8722c to your computer and use it in GitHub Desktop.
Save Mistic92/5043b682aa5742a7d7fad68c7ad8722c to your computer and use it in GitHub Desktop.
Ignite problems
@Repository
@Slf4j
@SuppressWarnings("unused")
@CacheConfig(cacheNames = {
"ch-last",
"ch-past", "ch-all",
"ch-current"})
public class RepositoryOne {
/**
* Do not call directly from the same class
*/
@Caching(evict = {
@CacheEvict(value = "ch-past", key = "{#uid,0}"),
@CacheEvict(value = "ch-current", key = "{#uid,0}"),
@CacheEvict(value = "ch-last", key = "{#uid,#somethingType.toString()}"),
@CacheEvict(value = "ch-given-time", key = "{#uid,#somethingType.toString()}"),
})
public void evictUsereData(final String uid, SomethingType somethingType) {
log.debug("Evicted something for uid:{}", uid);
}
@Override
@Cacheable(cacheNames = "ch-current", key = "{#userId.name(),#page}")
public List<SomethingEntity> getCurrentDataForUserId(DatastoreKey userId, int page) {
//...............
return something;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment