gnu-social/plugins/RedisCache
Miguel Dantas 5e16606358 [RedisCache] Fix call to getPayload on int. The library is badly documented, but seems to return the TTL instead of the normal redis response
Issue description as reported by aab:

About one day after enabling redis plugin:

PHP Fatal error:  Uncaught Error: Call to a member function getPayload() on int in /var/www/html/plugins/RedisCache/RedisCachePlugin.php:96
Stack trace:
0 /var/www/html/lib/event.php(89): RedisCachePlugin->onStartCacheSet('gnusocial:gatea...', Object(Queue_item), NULL, 86400, false)
1 /var/www/html/lib/cache.php(202): Event::handle('StartCacheSet', Array)
2 /var/www/html/classes/Memcached_DataObject.php(496): Cache->set('gnusocial:gatea...', Object(Queue_item))
3 /var/www/html/classes/Memcached_DataObject.php(416): Memcached_DataObject->encache()
4 /var/www/html/classes/Managed_DataObject.php(620): Memcached_DataObject->update(Object(Queue_item))
5 /var/www/html/classes/Queue_item.php(74): Managed_DataObject->update(Object(Queue_item))
6 /var/www/html/lib/dbqueuemanager.php(75): Queue_item::top(Array, Array)
7 /var/www/html/lib/iomaster.php(287): DBQueueManager->poll()
8 /var/www/html/lib/iomaster.php(161): IoMaster->poll()
9 /var/www/html/scripts/queuedaemon.php(112): IoMaster->service()
10 /var/www/html/lib/spawni in /var/www/html/plugins/RedisCache/RedisCachePlugin.php on line 96
2021-07-16 19:44:34 +01:00
..
README [RedisCache] Added README with configuration instructions 2021-07-16 19:44:33 +01:00
RedisCachePlugin.php [RedisCache] Fix call to getPayload on int. The library is badly documented, but seems to return the TTL instead of the normal redis response 2021-07-16 19:44:34 +01:00

README

Redis cache for GNU social

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

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

addPlugin('RedisCache', ['server' => 'tcp://localhost:6379']);

Settings
========

servers: Array of Redis servers addresses. A semicolon (`;`) should be used to separate
the address from the port, to allow for IPv6 addresses

defaultExpiry: How long before cache expires (in seconds)

Example
=======

```
    addPlugin('RedisCache', [ 'server' => 'tcp://localhost:6379',
                              'defaultExpiry' => 86400 // 24h
                            ]);
```

You can also use a unix socket instead of a tcp connection:

```
    addPlugin('RedisCache', ['server' => 'unix:/var/run/redis/redis.sock']);
```