Skip to content

sfAPCCache seems to not be compatible with apcu #48

@j0k3r

Description

@j0k3r

APCu seems to not use the same way to store "key".
sfAPCCache->getCacheInfo():

  protected function getCacheInfo($key)
  {
    if (!$this->enabled)
    {
      return false;
    }

    $infos = apc_cache_info('user');

    if (is_array($infos['cache_list']))
    {
      foreach ($infos['cache_list'] as $info)
      {
        if ($this->getOption('prefix').$key == $info['info'])
        {
          return $info;
        }
      }
    }

    return null;
  }

Before this if if ($this->getOption('prefix').$key == $info['info']), I vardumped the $info array and here it is for APCu & APC.
With APCu:

array (size=9)
  'key' => string 'account:/localhost/all/main/index/__sf_cache_key/item_tags_8267' (length=63)
  'ttl' => int 86400
  'nhits' => float 0
  'mtime' => int 1394384708
  'ctime' => int 1394384708
  'dtime' => int 0
  'atime' => int 1394384708
  'ref_count' => int 0
  'mem_size' => int 1712

And this with APC:

array (size=9)
  'info' => string 'account:/localhost/all/main/index/__sf_cache_key/item_tags_8267' (length=63)
  'ttl' => int 86400
  'nhits' => float 0
  'mtime' => int 1394384708
  'ctime' => int 1394384708
  'dtime' => int 0
  'atime' => int 1394384708
  'ref_count' => int 0
  'mem_size' => int 1712

Spot the first key from the array ? info != key
Should we create a sfAPCuCache ? The problem will also appear in removePattern().

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions