gnu-social/plugins/RedisCache
Miguel Dantas 9692150c23 Fix 'Call to a member function getPayload() on null'
Trying to enable the RedisCache with the latest nightly, getting this with the daemon:

sep 25 11:40:18 friedrich startdaemons.sh[21428]: PHP Fatal error:  Uncaught Error: Call to a member function getPayload() on null in /var/www/social/plugins/RedisCache/RedisCachePlugin.php:96
sep 25 11:40:18 friedrich startdaemons.sh[21428]: Stack trace:
sep 25 11:40:18 friedrich startdaemons.sh[21428]: #0 /var/www/social/lib/util/event.php(89): RedisCachePlugin->onStartCacheSet('gnusocial:herds...', Object(HubSub), NULL, 86400, false)
sep 25 11:40:18 friedrich startdaemons.sh[21428]: #1 /var/www/social/lib/cache/cache.php(202): Event::handle('StartCacheSet', Array)
sep 25 11:40:18 friedrich startdaemons.sh[21428]: #2 /var/www/social/classes/Memcached_DataObject.php(520): Cache->set('gnusocial:herds...', Object(HubSub))
sep 25 11:40:18 friedrich startdaemons.sh[21428]: #3 /var/www/social/classes/Memcached_DataObject.php(52): Memcached_DataObject->encache()
sep 25 11:40:18 friedrich startdaemons.sh[21428]: #4 /var/www/social/classes/Managed_DataObject.php(50): Memcached_DataObject::getClassKV('HubSub', 'hashkey', 'a38b9dc516371af...')
sep 25 11:40:18 friedrich startdaemons.sh[21428]: #5 /var/www/social/plugins/OStatus/classes/HubSub.php(47): Managed_DataObject::getKV('hashkey', 'a38b9dc516371af...')
sep 25 11:40:18 friedrich startdaemons.sh[21428]: #6 /var/www/social/plugins/OStatus/lib/hubprepqueuehandler.php(68): HubSub::getByHashkey('https://herds.e...', 'https://raki.so...')
sep 25 11:40:18 friedrich startdaemons.sh[21428]: #7 /var/www/social/plugins/RedisQueue/classes/RedisQueueManager.php(58): HubPrepQueueHandl in /var/www/social/plugins/RedisCache/RedisCachePlugin.php on line 96
Sign in to j
2021-07-16 19:44:35 +01:00
..
README [RedisCache] Added README with configuration instructions 2021-07-16 19:44:33 +01:00
RedisCachePlugin.php Fix 'Call to a member function getPayload() on null' 2021-07-16 19:44:35 +01:00

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']);
```