gnu-social/plugins/Memcached
Miguel Dantas d209964718 [Memcached] Fix call to undefined method `close`
Issue description as reported by aab:

Memcached config in config.php:

    addPlugin('Memcached', [ 'servers' => ['127.0.0.1', 11211],
                             'defaultExpiry' => 86400 // 24h
                           ]);

Memcached and php-memchached installed.

The error appears when executing startdaemons.

Log:

    PHP Fatal error:  Uncaught Error: Call to undefined method Memcached::close() in /var/www/html/plugins/Memcached/MemcachedPlugin.php:202
    Stack trace:
    #0 /var/www/html/lib/event.php(89): MemcachedPlugin->onStartCacheReconnect(false)
    #1 /var/www/html/lib/cache.php(273): Event::handle('StartCacheRecon...', Array)
    #2 /var/www/html/lib/spawningdaemon.php(209): Cache->reconnect()
    #3 /var/www/html/lib/spawningdaemon.php(188): SpawningDaemon->resetDb()
    #4 /var/www/html/lib/spawningdaemon.php(118): SpawningDaemon->initAndRunChild(3)
    #5 /var/www/html/lib/daemon.php(168): SpawningDaemon->run()
    #6 /var/www/html/scripts/queuedaemon.php(186): Daemon->runOnce()
    #7 {main}
      thrown in /var/www/html/plugins/Memcached/MemcachedPlugin.php on line 202
2019-09-03 03:30:07 +01:00
..
locale [PLUGINS] Removed GeoURL as the service doesn't exist anymore 2019-08-24 01:59:36 +01:00
MemcachedPlugin.php [Memcached] Fix call to undefined method `close` 2019-09-03 03:30:07 +01:00
README [PLUGINS] Updated and reviewed the Memcached plugin 2019-08-15 22:33:37 +01:00

README

The Memcached plugin implements cache interface for memcached.

See: http://memcached.org/

The difference between the former `MemcachePlugin` and `MemcachedPlugin` is that they use,
respectively, `memcache` and `memcached` as the underlying php libraries. These are similar
libraries, made by different authors with slightly different cacpabilities, therefore `memcached`
was selected.

Installation
============

Tell your `config.php` to use this plugin (replace `tcp://localhost:6379` with the address/port
of your Memcache backend server):

`addPlugin('Memcached');`

Note that this typically requires configuring the `memcached` extension for `php`, which is
typically available as a binary package from your system's package manager. In Debian based systems
and on Arch based systems, this is likely available under the `php-memcached` package. Note the
final `d`. On Arch, uncomment the line in `/etc/php/conf.d/memcached.ini` and restart your webserver
and/or php-fpm or similar.

Settings
========

servers: Array of memcached servers addresses. Each server address should be either a string with
address or an array where the first element is a string with the address an optional second element
with the port.

defaultExpiry: How long before cache expires (in seconds)

Example
=======

addPlugin('Memcached', [ 'servers' => ['127.0.0.1', 11211],
                         'defaultExpiry' => 86400 // 24h
                       ]);