Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined method: collection #52

Closed
zlo2k opened this issue Jul 23, 2021 · 1 comment
Closed

undefined method: collection #52

zlo2k opened this issue Jul 23, 2021 · 1 comment

Comments

@zlo2k
Copy link

zlo2k commented Jul 23, 2021

Hi!
I am trying to run a simple example and I get the error:

Fatal error: Uncaught Error: Call to undefined method MatthiasMullie\Scrapbook\Adapters\Memcached::collection() in test.php:8 Stack trace: #0 {main} thrown in test.php on line 8

Apache 2.4, PHP 7.2, Memcached server 1.5,
PHPINFO Memcached section:
Version | 3.1.4
libmemcached version | 1.0.18

<?php
require_once 'vendor/autoload.php';

$client = new \Memcached();
$client->addServer('localhost', 11211);
$cache = new \MatthiasMullie\Scrapbook\Adapters\Memcached($client);

$articleCache = $cache->collection('articles');
$sessionCache = $cache->collection('sessions');

$cache->set('key', 'value one');
$articleCache->set('key', 'value two');
$sessionCache->set('key', 'value three');

$articleCache->flush();

$cache->flush();

Maybe I was wrong about something?

@matthiasmullie
Copy link
Owner

The method to call is ->getCollection() rather than ->collection().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants