feat(object-cache): add Relay as a supported object cache driver - #1036
Open
faisalahammad wants to merge 1 commit into
Open
faisalahammad wants to merge 1 commit into
faisalahammad wants to merge 1 commit into
Conversation
faisalahammad
force-pushed
the
fix/906-relay-object-cache-driver
branch
2 times, most recently
from
August 9, 2026 13:08
64c0793 to
47f2535
Compare
Add support for the Relay PHP extension (relay.so) as a third object
cache driver alongside the existing Redis and Memcached options.
Relay is a Redis-compatible, shared-memory PHP extension that provides
an in-memory cache layer at the PHP process level. It is API-compatible
with phpredis for the calls this plugin makes.
Changes:
- src/base.cls.php: Register O_OBJECT_KIND in _conf_multi_switch() to
accept value 2 (Relay). Values 0 and 1 remain backward-compatible.
- src/conf.cls.php: Fix multisite multi-switch option handling in
network_update() so integer values (0/1/2) are preserved.
- src/object-cache.cls.php:
- Change _cfg_method to an integer (0/1/2) instead of boolean.
- Add _resolve_driver() to map the integer to a class name.
- Add _driver_cls_exists() to check driver availability.
- In _connect(), instantiate \Relay\Relay for value 2; skip
phpredis-only OPT_REPLY_LITERAL for Relay. Accept '+PONG' and boolean
true as valid PING responses.
- Extend get(), set(), delete(), and flush() to treat Relay the same
as Redis (they share the same wire protocol API).
- Catch \Exception in addition to \RedisException to gracefully handle
\Relay\Exception.
- Make _redis_error() driver-aware (logs 'Relay' vs 'Redis').
- tpl/cache/settings_inc.object.tpl.php:
- Show Relay extension status badge in the status row.
- Expand the Method switch from 2 options to 3 (Memcached/Redis/Relay).
- Update port auto-fill JS: Relay (value 2) also defaults to 6379.
Closes litespeedtech#906
faisalahammad
force-pushed
the
fix/906-relay-object-cache-driver
branch
from
August 9, 2026 13:11
47f2535 to
b32100d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add support for the Relay PHP extension (
relay.so) as a third object cache driver option alongside Memcached and Redis in LiteSpeed Cache settings.Relay is a Redis-compatible, shared-memory PHP extension that provides an in-memory cache layer at the PHP process level. It is API-compatible with phpredis for all object caching calls this plugin uses (
connect,pconnect,auth,select,get,set,del,flushDb,rawCommand).Closes #906
Type of Change
conf.cls.php)Proposed Changes
src/base.cls.php:O_OBJECT_KINDin_conf_multi_switch()to accept value2(Relay).src/conf.cls.php:network_update()multi-switch check so integer values (0/1/2) are preserved instead of being cast to boolean.src/object-cache.cls.php:_cfg_methodto integer representation (0= Memcached,1= Redis,2= Relay)._resolve_driver()and_driver_cls_exists()helper methods._connect()to instantiate\Relay\Relayfor value2, skip phpredis-only options, and validate PING responses ('PONG','+PONG',true).get(),set(),delete(), andflush()through Relay when selected.\Exceptioncatch block to safely catch\Relay\Exception(which does not extend\RedisException)._redis_error()driver-aware for log messages and admin notices.tpl/cache/settings_inc.object.tpl.php:Memcached,Redis,Relay).2) defaults to port6379.Verification & Testing
composer run sniff-check— 0 errors, 0 warnings (exit 0).php -l) on all modified files.0) or Redis (1) are unaffected. If Relay is selected butrelay.sois not installed,class_exists()check keeps object cache safely disabled.