[dev] [cvs] commit: framework/Cache/Cache file.php

Michael M Slusarz slusarz at horde.org
Fri Mar 9 03:16:22 UTC 2007


Quoting Chuck Hagenbuch <chuck at horde.org>:

> Quoting Michael M Slusarz <slusarz at horde.org>:
>
>>   Log:
>>   Fix get/set implementations - Cache API is clear that data can be mixed so
>>   it is the driver's responsibility to (un)serialize the data.
>
> The driver _can't_ unserialize the data. It doesn't know if it was
> serialized in the first place. So this breaks caching of string data.
> This needs to be reverted. Same for the serialization.

There is absolutely no harm in double serializing data.  Unserializing  
data we *know* has been serialized (see set()) is perfectly fine.  Not  
sure how this breaks caching of string data.

If you are concerned about data already stored in a cache that has not  
been serialized, then the unserialize() call in get() will return  
false indicating the cache is stale.  Obviously, there is absolutely  
no way you need to be required code that works with existing cached  
data.

>>   Use file_put_contents() if available.
>
> This just makes the code longer and I doubt it saves us anything. So
> in code that needs to work with PHP 4, let's just skip it for now.

Again, there is a function_exists() check.  benchmark results (don't  
have the url handy) indicates file_put_contents() is much more  
resource efficient than 3 separate function calls the old way.

michael

___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the dev mailing list