|
Hi Rod
I've started to use your cache implementation in
earnest lately, its a good piece of work, thanks. I've been meaning to evaluate
Aaron's work also and see how we can all combine our ideas.
I have a few comments on your API.
* Is there much code that depends on this API yet.
Can we tweak the API somewhat without burdening people with excessive
maintenance?
* I'd prefer a few method names to closer reflect
the Java Collections Framework naming for consistency
get() rather than
retrieve()
put() rather than
store()
remove(key) rather than
clear(key)
* a size() method to return the number if items in
the cache would be useful
* some mechanism for iterating through the current
cache contents, getting an iterator through the keys or something of that ilk
would be useful. e.g.
Iterator
keyIterator();
* What do you think about relaxing the prerequisite
that all keys and values in the cache must be Serializeable? I understand for
RMI and writing to disk this makes sense but I often want to cache transient
objects (or transient transformations of persistent state). (The RMI or disk
serializers could always ignore cache content that is not Serializeable). Often
we want to cache things to avoid remote communication or reading from
disk.
* I'd like a method like the put() method from
Map
Object put( Object key, Object
value )
which is similar to the current
method:-
boolean store( Serializable key,
Serializable value, Long expiry, Long cost )
but
(i) the previous value is returned rather than a
true / false indicator of whether this new value was stored. This makes it easy
to do change listeners and such like. I can't see to many application
developers caring too much whether store() actually stores the object or not. Do
you have a specific need for this boolean? Returning the previous value would
also mirror the Map interface in the Java Collections Framework.
(ii) the values of the expiry and cost arguments
come from the cache themselves rather than the application programmer. Defaults
could be applied to a particular cache (region) via a config file or whatever.
Often an application developer doesn't know what these values are
* Similarly I'd like the remove() method to return
the previous value that was in the cache or null if there is nothing cached for
the key, to be similar to the Map.remove(key) method.
public Object remove( Object key
);
Thoughts?
James
|
Title: RE: [PROPOSAL] Cache project...
- [PROPOSAL] Cache project... James Strachan
- Re: [PROPOSAL] Cache project... Craig R. McClanahan
- Re: [PROPOSAL] Cache project... James Strachan
- RE: [PROPOSAL] Cache project... David Duddleston
- RE: [PROPOSAL] Cache project... Waldhoff, Rodney
- Re: [PROPOSAL] Cache project... James Strachan
- Re: [PROPOSAL] Cache project... Craig R. McClanahan
- Re: [PROPOSAL] Cache project... James Strachan
- Re: [PROPOSAL] Cache project... Waldhoff, Rodney
- RE: [PROPOSAL] Cache project... Tim Vernum
- RE: [PROPOSAL] Cache project... Waldhoff, Rodney
- Re: [PROPOSAL] Cache project... James Strachan
