Changeset 39755 in spip-zone for _plugins_/memoization/memo/xcache.inc


Ignore:
Timestamp:
Aug 10, 2010, 8:39:21 AM (10 years ago)
Author:
fil@…
Message:

maintenant xcache.inc sait gerer les objects

File:
1 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/memoization/memo/xcache.inc

    r32482 r39755  
    1818
    1919function cache_get($key) {
    20         return xcache_get(_CACHE_NAMESPACE.$key);
     20        $a = xcache_get(_CACHE_NAMESPACE.$key);
     21        // maybe_unserialize
     22        if (is_array($a))
     23                return @unserialize($a[0]);
     24        else
     25                return $a;
    2126}
    2227
    2328function cache_set($key, $value, $ttl=null) {
     29        // maybe_serialize
     30        if (is_object($value) OR is_array($value))
     31                $value = array(serialize($value));
    2432        return is_null($ttl)
    2533                ? xcache_set(_CACHE_NAMESPACE.$key, $value)
Note: See TracChangeset for help on using the changeset viewer.