You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directmemory.apache.org by Tommaso Teofili <to...@gmail.com> on 2011/12/15 13:54:52 UTC

Cache keys

Hi all,

while working on one of the examples I found myself wondering why keys in
Cache have to be Strings.
Generally a cache should also be able to use objects of whatever nature as
keys, so we could use the same serialization mechanism used for values or,
at least, define keys to be implementing the java.io.Serializable interface.
What do you think?

Tommaso

Re: Cache keys

Posted by "Raffaele P. Guidi" <ra...@gmail.com>.
Great! Right, keys are managed by the guava map that don't require
Serializable
Il giorno 29/dic/2011 20:01, "Maurizio Cucchiara" <mc...@apache.org>
ha scritto:

> AFAICU there is no reason to implement the Serializable IF, since keys
> are not serialized (I could be wrong though)
> The switch from string to object looks apparently simple, I haven't
> experienced any issues until now (every test run smoothly) .
> I'm going to attach a patch on DIRECTMEMORY-43 [1], please let me know
> WDYT.
>
> [1] https://issues.apache.org/jira/browse/DIRECTMEMORY-43
>
>
> Twitter     :http://www.twitter.com/m_cucchiara
> G+          :https://plus.google.com/107903711540963855921
> Linkedin    :http://www.linkedin.com/in/mauriziocucchiara
>
> Maurizio Cucchiara
>
>
>
> On 15 December 2011 15:28, Raffaele P. Guidi <ra...@gmail.com>
> wrote:
> > Sure it would be a good thing, of course keeping the most frequent use
> case
> > as simple as possibile. Also remember that one of the things that allows
> > DirectMemory to perform well is protostuff - that is an efficient and
> > unobtrusive way to work around serialization.
> >
> > Ciao,
> >   R
> > Il giorno 15/dic/2011 13:56, "Tommaso Teofili" <
> tommaso.teofili@gmail.com>
> > ha scritto:
> >
> >> Hi all,
> >>
> >> while working on one of the examples I found myself wondering why keys
> in
> >> Cache have to be Strings.
> >> Generally a cache should also be able to use objects of whatever nature
> as
> >> keys, so we could use the same serialization mechanism used for values
> or,
> >> at least, define keys to be implementing the java.io.Serializable
> >> interface.
> >> What do you think?
> >>
> >> Tommaso
> >>
>

Re: Cache keys

Posted by Maurizio Cucchiara <mc...@apache.org>.
AFAICU there is no reason to implement the Serializable IF, since keys
are not serialized (I could be wrong though)
The switch from string to object looks apparently simple, I haven't
experienced any issues until now (every test run smoothly) .
I'm going to attach a patch on DIRECTMEMORY-43 [1], please let me know WDYT.

[1] https://issues.apache.org/jira/browse/DIRECTMEMORY-43


Twitter     :http://www.twitter.com/m_cucchiara
G+          :https://plus.google.com/107903711540963855921
Linkedin    :http://www.linkedin.com/in/mauriziocucchiara

Maurizio Cucchiara



On 15 December 2011 15:28, Raffaele P. Guidi <ra...@gmail.com> wrote:
> Sure it would be a good thing, of course keeping the most frequent use case
> as simple as possibile. Also remember that one of the things that allows
> DirectMemory to perform well is protostuff - that is an efficient and
> unobtrusive way to work around serialization.
>
> Ciao,
>   R
> Il giorno 15/dic/2011 13:56, "Tommaso Teofili" <to...@gmail.com>
> ha scritto:
>
>> Hi all,
>>
>> while working on one of the examples I found myself wondering why keys in
>> Cache have to be Strings.
>> Generally a cache should also be able to use objects of whatever nature as
>> keys, so we could use the same serialization mechanism used for values or,
>> at least, define keys to be implementing the java.io.Serializable
>> interface.
>> What do you think?
>>
>> Tommaso
>>

Re: Cache keys

Posted by "Raffaele P. Guidi" <ra...@gmail.com>.
Sure it would be a good thing, of course keeping the most frequent use case
as simple as possibile. Also remember that one of the things that allows
DirectMemory to perform well is protostuff - that is an efficient and
unobtrusive way to work around serialization.

Ciao,
   R
Il giorno 15/dic/2011 13:56, "Tommaso Teofili" <to...@gmail.com>
ha scritto:

> Hi all,
>
> while working on one of the examples I found myself wondering why keys in
> Cache have to be Strings.
> Generally a cache should also be able to use objects of whatever nature as
> keys, so we could use the same serialization mechanism used for values or,
> at least, define keys to be implementing the java.io.Serializable
> interface.
> What do you think?
>
> Tommaso
>