Many thanks for your response. So my thinking was correct in this way: process 1 -> set($tag1,$hash); data unique to process 1 process 1 -> get($tag1,$hash); process 2 -> set ($tag2,$hash); data unique to process 2 process 2 -> get($tag2,$hash);
each process must have a unique key to manipulate the hash via set and get the question remains - how to clean up afterwards - when process 1 quits - drop $tag1 from memcache On Tuesday, November 24, 2015 at 10:07:40 AM UTC-7, perrin wrote: > On Tue, Nov 24, 2015 at 11:05 AM, Joseph Norris <[email protected] > <javascript:>> 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 > > > -- --- You received this message because you are subscribed to the Google Groups "memcached" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
