[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Remove all items beginning with part of a key  XML
Forum Index -> Ehcache
Author Message
efferson

neo

Joined: 10/06/2010 07:14:32
Messages: 3
Location: Novosibirsk
Offline

Can I remove all elements of cache whose keys begin with the specified prefix?

For example I have 2 functions: first

Code:
public String doA(Integer userId, String someValue)


that I want to cache (with cache key "doA:" + userId + ":" + someValue), and second

Code:
public String doB(Integer userId)


that should drops cache of function "doA" for current userId (cache keys started with "doA:" + userId + ":").

I found that I can solve my problem using "getKeys*" functions and iterating over all keys searching for matches... but I thing it is wrong solution :(
gluck

qaestor

Joined: 09/15/2009 18:01:23
Messages: 179
Location: Brisbane, Australia
Offline

Not at the moment.

But we are adding search to ehcache. It will let you do a regular expression search.

Look for the beta in November.
efferson

neo

Joined: 10/06/2010 07:14:32
Messages: 3
Location: Novosibirsk
Offline

Are you going to add support for cache tags?

For example, method "put" will have third parameter String[] with names of tags. When we want to invalidate all caches tagged by certain tag we will call method "resetTag(String name)". Nice, isn't it?

Of course, I can write some util classes that provide this functional. But I think that it will look more correctly as part of standard functional.
gluck

qaestor

Joined: 09/15/2009 18:01:23
Messages: 179
Location: Brisbane, Australia
Offline

Efferson

The tag idea we call groups. It got done last year but has not been merged in. I am hoping to do that soon.
efferson

neo

Joined: 10/06/2010 07:14:32
Messages: 3
Location: Novosibirsk
Offline

Please, do it :)
gluck

qaestor

Joined: 09/15/2009 18:01:23
Messages: 179
Location: Brisbane, Australia
Offline

Hi, the Ehcache Search is now out in alpha. You can give it a go. See http://ehcache.org/documentation/search.html
rajoshi

seraphim

Joined: 07/04/2011 04:36:10
Messages: 1491
Offline

Issue seems to be resolved.Please let us know if more information is required.

Rakesh Joshi
Senior Consultant
Terracotta.
vyasmind

neo

Joined: 02/08/2012 21:23:39
Messages: 1
Location: Hyderabad
Offline

Please point me to the sample code or code snippet to understand the implementation.

Manish Vyas
[WWW] [Yahoo!]
 
Forum Index -> Ehcache
Go to:   
Powered by JForum 2.1.7 © JForum Team