You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-users@jakarta.apache.org by Peter Snow <pe...@aya.yale.edu> on 2006/06/18 08:41:35 UTC

Storing objects in the disk cache

Hi,

I have a question about how the disk cache stores objects.

Suppose I have two caches - one for Book objects and one for Bookcase
objects. Bookcase objects can contain collections of Books.

Presumably, in a MemoryCache what are stored are references to objects
on the heap. So, in the Book cache, the values in the cache are pointers
to the memory addresses of the actual Book objects sitting out on the
heap. The Bookcase cache would work the same way. If a Bookcase object
contained some Book objects that also happened to be in the Book cache
as well, the cache for this Bookcase object would contain references to
the same Book memory addresses on the heap. In other words, we wouldn't
have duplicates of the same Book objects in both caches, only duplicates
of their references or pointers.

Now if the contents of both caches get serialized to the same disk cache
will we have a similar "duplicate-free" storage of each cache's object
graph? Will Books contained by a Bookcase object be simply be pointers
to the same Book addresses that are in the serialized Book cache? Or
will the contents of the Bookcase cache and the Book cache be
independent of one another? In other words, would it be possible to have
duplicates of a particular Book in the disk cache?

Thanks for any insight.

---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


Re: Storing objects in the disk cache

Posted by Peter Snow <pe...@aya.yale.edu>.
Al,

Thanks. Answers my question. Thanks for pointing me in the right
direction (and taking the time to write it - if you are the author).

Peter


Alistair Forbes wrote:
> Hi,
> 
> Have a look at http://sindome.org/JCS/JCSRemoteCacheHowTo.doc . The last
> part of the document  describes what happens.
> 
> Regards
> Al
> 
> On 6/18/06, Peter Snow <pe...@aya.yale.edu> wrote:
> 
>>
>> Hi,
>>
>> I have a question about how the disk cache stores objects.
>>
>> Suppose I have two caches - one for Book objects and one for Bookcase
>> objects. Bookcase objects can contain collections of Books.
>>
>> Presumably, in a MemoryCache what are stored are references to objects
>> on the heap. So, in the Book cache, the values in the cache are pointers
>> to the memory addresses of the actual Book objects sitting out on the
>> heap. The Bookcase cache would work the same way. If a Bookcase object
>> contained some Book objects that also happened to be in the Book cache
>> as well, the cache for this Bookcase object would contain references to
>> the same Book memory addresses on the heap. In other words, we wouldn't
>> have duplicates of the same Book objects in both caches, only duplicates
>> of their references or pointers.
>>
>> Now if the contents of both caches get serialized to the same disk cache
>> will we have a similar "duplicate-free" storage of each cache's object
>> graph? Will Books contained by a Bookcase object be simply be pointers
>> to the same Book addresses that are in the serialized Book cache? Or
>> will the contents of the Bookcase cache and the Book cache be
>> independent of one another? In other words, would it be possible to have
>> duplicates of a particular Book in the disk cache?
>>
>> Thanks for any insight.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: jcs-users-help@jakarta.apache.org
>>
>>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jcs-users-help@jakarta.apache.org


Re: Storing objects in the disk cache

Posted by Alistair Forbes <fo...@googlemail.com>.
Hi,

Have a look at http://sindome.org/JCS/JCSRemoteCacheHowTo.doc . The last
part of the document  describes what happens.

Regards
Al

On 6/18/06, Peter Snow <pe...@aya.yale.edu> wrote:
>
> Hi,
>
> I have a question about how the disk cache stores objects.
>
> Suppose I have two caches - one for Book objects and one for Bookcase
> objects. Bookcase objects can contain collections of Books.
>
> Presumably, in a MemoryCache what are stored are references to objects
> on the heap. So, in the Book cache, the values in the cache are pointers
> to the memory addresses of the actual Book objects sitting out on the
> heap. The Bookcase cache would work the same way. If a Bookcase object
> contained some Book objects that also happened to be in the Book cache
> as well, the cache for this Bookcase object would contain references to
> the same Book memory addresses on the heap. In other words, we wouldn't
> have duplicates of the same Book objects in both caches, only duplicates
> of their references or pointers.
>
> Now if the contents of both caches get serialized to the same disk cache
> will we have a similar "duplicate-free" storage of each cache's object
> graph? Will Books contained by a Bookcase object be simply be pointers
> to the same Book addresses that are in the serialized Book cache? Or
> will the contents of the Bookcase cache and the Book cache be
> independent of one another? In other words, would it be possible to have
> duplicates of a particular Book in the disk cache?
>
> Thanks for any insight.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jcs-users-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jcs-users-help@jakarta.apache.org
>
>