"Set" and then "get" don't retrieve the stored value

Kristian Hellquist kristian.hellquist at gmail.com
Mon Nov 13 17:03:15 UTC 2006

Hi all!

Im happy user of memcached but I have run into some strange problems.
In some cases memcached doesnt retrieve the value that I just set.
When using "ngrep" the value seems to be stored in memcached, memcached
returns "STORED". But, If I try to do a "get" I get a blank value
back, and if try to "delete" the value I get "NOT_FOUND". Do I have to
wait a specific time before the value can be retrieved?

Im pretty sure that the same key is used in all cases and the dump
seems to confirm this, if I have read it correctly.

Anyone have a clue of whats is going on here or have a suggestion of
how I can debug this further? Im using memcached 1.2.0.

/Cheers Kristian

Heres the dump from ngrep and last information about memcached status
provided from the command "stats":

T -> [AP]
  set 65b05a7489ea704c5afb80fee7b029497a80beac 0 0
1376....o:.View.:. at new_recordT:. at viewableo:@ActiveRecord::Associations::BelongsToPolymorphicAssociation
  .:. at targeto:.User.:. at attributes{+".new_email0".screen_name_soundex0".login_soundex".1".updated_at0".login_nysiis".BAB".birthdate0".invited_users_count".
is friend to other bobbians. Bla bla bla.".country_id".SW".activation_
is bad to the bone".login_reversed".ybbob".birthday".2000-02-
  obby is the bestest".first_name".Bob".screen_name_lowered0".inhabited_location_id".1".last_name".Thornton".password"-42c0c4e207b42710a8bd62d07cfd89d7249
00:00:00".email".bobby at test.adocca.com".superuser".0:. at loadedT:. at reflec
  tiono:4ActiveRecord::Reflection::AssociationReflection.:. at options{.:.foreign_type".viewable_type:.polymorphicT:. at class_name".Viewable:. at active_recordc.V
  iew:. at primary_key_name".viewable_id:. at through_reflectionF:. at name:.viewable:. at macro:.belongs_to:. at updatedT:. at owner@.;.{.".viewed_atu:.Time.......
T -> [AP]
T -> [AP]
  get 65b05a7489ea704c5afb80fee7b029497a80beac..
T -> [AP]
T -> [AP]
  delete 65b05a7489ea704c5afb80fee7b029497a80beac 0..
T -> [AP]

And here is info from "stats":

STAT pid 18766
STAT uptime 3566
STAT time 1163436542
STAT version 1.2.0
STAT pointer_size 32
STAT rusage_user 0.022996
STAT rusage_system 0.061990
STAT curr_items 3
STAT total_items 45
STAT bytes 3348
STAT curr_connections 4
STAT total_connections 16
STAT connection_structures 5
STAT cmd_get 37
STAT cmd_set 45
STAT get_hits 2
STAT get_misses 35
STAT bytes_read 42109
STAT bytes_written 7694
STAT limit_maxbytes 134217728

More information about the memcached mailing list