atom feed5 messages in com.googlegroups.memcachedRe: memcache and perl question
FromSent OnAttachments
Joseph NorrisNov 24, 2015 8:05 am 
Perrin HarkinsNov 24, 2015 9:07 am 
Joseph NorrisNov 24, 2015 9:21 am 
Perrin HarkinsNov 24, 2015 9:29 am 
Joseph NorrisNov 24, 2015 3:52 pm 
Subject:Re: memcache and perl question
From:Perrin Harkins (phar@gmail.com)
Date:Nov 24, 2015 9:07:31 am
List:com.googlegroups.memcached

On Tue, Nov 24, 2015 at 11:05 AM, Joseph Norris <joze@gmail.com> wrote:

if I set a tag to a value of a hash:

$self->{cache}->set('tag',$hash);

is the hash ref set in memcache that will point back to my hash or do I have to actually have a %hash to be used in $self->{cache}->set('tag',%hash);

Like all other caching modules that do anything outside of your local process, Cache::Memcached passes your data to Storable to flatten it into a blob of data, so what gets sent over the wire is just that blob with the complete contents of your hash. Storable will follow references.

and do I have to have some unique identifier for the the tag so that the in

memory hash will be related to the actual script that is calling it. in other words will each run of the script get a different instance of 'tag' with its own unique %hash?

I'm not sure I understand what you're asking. When you call get() on the cache to load the hash, binary data gets passed to Storable and turned into a hash in your local process. If you make changes to the local hash after that without storing them back to memcached, no other process will see them. If you call get() on the same key in another process, that process will also get a hash in local memory, and no connection will exist between that and the one in your first process.

- Perrin