jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Smuts <aasm...@wisc.edu>
Subject RE: composite keys and cache entries keys retrieval
Date Fri, 11 Jul 2003 13:30:26 GMT
Right now you can only use hierarchical delete if you know the beginning
of the key.  The idea was that it would be too slow to look for a
partial match.  Perhaps it would be fine.  The idea was that groups
would solve tis other problem.  You would put everything in a page group
and then delete everything starting with that userid.

Since groups are sketchy, you might be able to solve your problem
another way.  You could setup a region for each pageid.

Alternatively, you just set up auto expiration for the elements.  I
assume the biggest worry is that you don't want to serve a stale page,
so the pageid takes priority.  I figure that expiring things related to
a user is not your security layer, but is a cleanup move.  Cleanup can
be done passively without many drawbacks.  Just name your elements
pageid:userid and have them expire automatically.  Then if a pageid get
changed, you can remove( pageid + ":" )

This is simpler and should perform better overall.  You don't want to
iterate through the keys of a map that can change underneath you if you
can avoid it.

Aaron

> -----Original Message-----
> From: Fulco Houkes [mailto:foux.dev@foux.net]
> Sent: Friday, July 11, 2003 5:28 AM
> To: JCS user mailinglist
> Subject: composite keys and cache entries keys retrieval
> 
> 
> Hi,
> 
> (Sorry for this cross-posting, I noticed I send it to the wrong
mailing
> list. My appologizes.)
> 
> I'm try to use a composite key for all the cache entries; the
composite
> key is combination of a pageID and a username. I need to be able to
> invalidate all the cache entries related to a specific pagesID as well
as
> all the cache entries related to a username independently.
> 
> I tried to use groups for this purpose, but it seems the entries are
> duplicated into the different groups, so it's not solving my problem.
I've
> been looking for using the ":" hierarchy features, but the
"very-light"
> documentation does present much on the subject, and I could not remove
> entries using the pattern  ":"+ myKey +":". As far as I understood it,
> it's only possible to use this functionality with the myKey+":"
pattern.
> 
> Finally I opted to retrieve all the cache entries keys and filter
myself
> the entries to be invalidated. But I could not found any method (from
the
> JCS class) returning a Set/Enumeration/... of keys of all the the
cache
> entries. The IMemoryCache interface has a getKeyArray() method, which
does
> the job, but this method is not used within the inherited classes.
> 
> Does anyone know how to retrieve the keys of all the entries present
in
> the cache, without having to change the source code?
> 
> Thanks a lot.
> Fulco Houkes


Mime
View raw message