[infinispan-dev] Infinispan REST server

Michael Neale michael.neale at gmail.com
Tue Sep 1 19:29:23 EDT 2009


On Thu, Aug 27, 2009 at 9:22 PM, Manik Surtani<manik at jboss.org> wrote:
>
> Entries are stored internally as InternalCacheEntry [1] instances.  If
> you look at the object hierarchy, ICE is implemented by
> ImmortalCacheEntry, MortalCacheEntry, TransientCacheEntry and
> TransientMortalCacheEntry (ah, for Scala traits to make this
> cleaner!  :)
>
>
> Where do you see a use for this information?  And in what cases do you
> need it - i.e., for all entries?  Only entries that specify a lifespan
> or maxIdle?

OK - what I am doing is serving and taking content from a RESTful http
interface - that means I need (ideally) Content-Type and Last-Modified
headers...
>From the sounds of it, there isn't an easy and reliable way to get
this out of the core (certainly not the content type, I would have to
guess...)

So what I did is create a CacheEntry object, which wraps the data as a
byte[], and has both a timestamp and the content-type (as a MIME media
type).
I am thinking I should move this to core in case someone wants to
programmatically from the java api get to the data, and needs to know
the MIME type (eg for indexing, or publishing) - good idea?

If there is an element in the cache that someone wants to do a GET on
which is NOT an instance of CacheEntry, I can probably work out how to
stream that to them (and guess the content type) - either that or we
just do all content as application/octet-stream (but I am trying to
provide a most excellent REST interface for great good !)....

>
> [1] http://fisheye.jboss.org/browse/Infinispan/trunk/core/src/main/java/org/infinispan/container/entries/InternalCacheEntry.java?r=433
>

Excellent - so there seems to be at least a created timestamp here
(which may or may not be what I want) - how would one go about getting
at this from the Cache inferface (via casting) in a reasonably future
safe way?




-- 
Michael D Neale
home: www.michaelneale.net
blog: michaelneale.blogspot.com




More information about the infinispan-dev mailing list