Invalidate List when individual object is deleted

20 views
Skip to first unread message

James Shaughnessy

unread,
Sep 30, 2013, 11:11:11 AM9/30/13
to ehcache-sprin...@googlegroups.com
Hey,

So, I have two methods:

@Cacheable(cacheName = "foobar",
 keyGenerator = @KeyGenerator(name = "HashCodeKeyGenerator",
 properties = @Property(name = "includeMethod", value = "false")))
public List<Foobar> getFoobars(int foobarId){
     return dao.getFoobars(foobarId);
}


@TriggersRemove(cacheName = "foobar",
 keyGenerator = @KeyGenerator(name = "HashCodeKeyGenerator",
 properties = @Property(name = "includeMethod", value = "false")))
public Foobar deleteFoobar(Foobar foobar){
    dao.delete(foobar);
    return foobar;
}

When a Foobar is deleted, I want to remove all List<Foobar> objects that contain it from the cache.
How can I accomplish this with annotations or ehcache methods?

Thanks,

- James
Reply all
Reply to author
Forward
0 new messages