> problem: > today i need 4 packets to make 'lock'/'unlock' using memcache > i need to use less ROM/CPU/RAM/network at client side > > solution: > 1) make server side lock function with 2 packet (with atomic operations) > 2) make a proxy if function = lock/unlock, proxy make these packets to > server (i don't have atomic here, but i can implement with a big work > on protocol, maybe a new memcached hehe) > > i will try the second one without atomic (today i'm using it, i have > some problems, but client side workaround it with more packets... > (retry) ) > the first is better (i don't need a proxy, i have less packets, use > less cpu, ram, rom, time) > > packets: > LOCK > add value (1 packet sent by client, 1 packet sent by server) > if no error (end here) > if value exist > read value (1packet sent by client, 1 packet sent by server) > if value=my value (my lock) if not (not my lock) > > UNLOCK > read value (1packet sent by client, 1 packet sent by server) > if value != my value > (end here) > delete value (1packet sent by client, 1 packet sent by server) > (end here)
I think he means to step back a bit, and describe what problem it is that lead you to needing to access memcached from a PIC. ie; what is the specific work that the PIC is doing which needs synchronization and perhaps repeated accesses to memcached?
