Bug #4602

memcache doesn't work

Added by Irene Höppner over 10 years ago. Updated over 9 years ago.

Status:
Resolved
Priority:
Must have
Category:
Cache
Start date:
2009-09-12
Due date:
% Done:

100%

PHP Version:
Has patch:
Complexity:

Description

I tried to use memcache for parts of the cache.

Added the following configuration to Caches.yaml:

Default:
  backend: F3\FLW3\Cache\Backend\MemcachedBackend
  backendOptions:
    defaultLifetime: 0
    Servers: [localhost:11211]

This error occurs:

Fatal error: Call to a member function getScriptPathAndFilename() on a non-object in C:\Programme\xampp\htdocs\f3\intranet\Packages\Framework\FLOW3\Classes\Cache\Backend\MemcachedBackend.php on line 175

To check, wether the memcached-server is up and running, I used the following PHP-script:

<?php

$memcache = new Memcache;
$memcache->connect('localhost', 11211) or die ("Could not connect");

$version = $memcache->getVersion();
echo "Server's version: ".$version."<br/>\n";

$tmp_object = new stdClass;
$tmp_object->str_attr = 'test';
$tmp_object->int_attr = 123;

$memcache->set('key', $tmp_object, false, 10) or die ("Failed to save data at the server");
echo "Store data in the cache (data will expire in 10 seconds)<br/>\n";

$get_result = $memcache->get('key');
echo "Data from the cache:<br/>\n";

var_dump($get_result);

?>

The result is:

Server's version: 1.2.1
Store data in the cache (data will expire in 10 seconds)
Data from the cache:
object(stdClass)#3 (2) { ["str_attr"]=> string(4) "test" ["int_attr"]=> int(123) }

Associated revisions

Revision 2f4303f9 (diff)
Added by Karsten Dambekalns over 10 years ago

[+BUGFIX] FLOW3 (Cache): Added missing dependency configuration for memcache and APC backends to Objects.yaml, fixes #4602.
[~TASK] FLOW3 (Cache): Fixed memcache (and APC) backend to use the cache identifier in their prefix in order to not overwrite entries from different caches having the same entry identifier. Tweaked Caches.yaml so it is possible to change the default cache backend to something with more options than the TransientMemoryBackend. Relates to #4602.

History

#1 Updated by Karsten Dambekalns over 10 years ago

  • Category set to Cache
  • Status changed from New to Accepted
  • Assignee set to Karsten Dambekalns
  • Target version set to 1.0 alpha 5

#2 Updated by Karsten Dambekalns over 10 years ago

First issue: Objects.yaml misses the dependencies for the backend, autowiring is off. Solved.
Next issue: Settings default options breaks with backends that don't support them... bah!

I'm at it...

#3 Updated by Karsten Dambekalns over 10 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 0 to 100

Applied in changeset r3210.

Also available in: Atom PDF