Memcached PHP Sessions

Reinis Rozitis roze at roze.lv
Fri Feb 2 16:45:18 UTC 2007


> since i need only change array index 0 on first and index 1 on second i
> shouldn't change all array because i will get the last changed, could we
> implement some features ONLY for ARRAY (or coletions (associative
> with it we could get array back with
> ->fetch('variable')
> or better:
> ->fetch('variable[index that i want]');

There is no way that MemCached could do it at least at the current state
(and In my opinion there is also no need).
Cause Memcached does NOT have any idea about PHPs data structure or any
programming language's.
In case of php the data stored is as serialised string and if you want to
fetch only part Memcached would have to operate with some substrings and on
update try to squeeze back in and rewrite the whole syntax (like length/type
and so on).

If you want to partly fetch/update use different keys for each array
element:
For example $variable[0] = 'value'; becomes set('variable_0','value') ..

> I still have to transfer whole array to get one index. If I want to change
something, whole array has to be transfered again.

This indicates you are using MemCached the wrong way and your data should be
packed (splited) in a different manner (see above).

rr



More information about the memcached mailing list