cachewerk / relay

The next-generation caching layer for PHP powered by Redis.
https://relay.so
MIT License
197 stars 10 forks source link

Relay::expire() throws an error when not setting $mode parameter. #140

Closed kkrasnik closed 5 months ago

kkrasnik commented 5 months ago

Relay::expire() throws an error when not setting $mode parameter.

Description

Method declaration is as follows: public function expire(mixed $key, int $seconds, ?string $mode = null): Relay|bool {} According to the above, it is correct to call the code: $relay->zadd('test-key-1', 'member123', 123); $relay->expire('test-key-1', 300);

Expected Behavior

Success.

Actual Behavior

Running above example ends up getting the following error: Relay\\Relay::expire(): Unknown expiration mode ''

Possible Fix

Probably you perform casting $mode parameter value to string.

Steps to Reproduce

As description states.

Additional context

Relay diagnostics

Relay Support => enabled
Relay Version => 0.8.0
Available cache => 16722880
Available serializers => php, json, igbinary, msgpack
Available compression => lzf, zstd, lz4
Binary UUID => d1417375-09c2-4dd4-a41e-de080c97c729
Git SHA =>  
Allocator => relay
Build OS => Ubuntu 22.04.2 LTS
Architecture => x86_64
OpenSSL version => OpenSSL 3.0.2 15 Mar 2022
License state => unknown
License memory cap => 0
License request id =>  
relay.enabled => true
relay.environment => development
relay.key =>  
relay.maxmemory => 16777216
relay.maxmemory_pct => 95
relay.eviction_policy => noeviction
relay.eviction_sample_keys => 128
relay.initial_readers => 128
relay.invalidation_poll_usec => 5
relay.pconnect_default => 1
relay.max_endpoint_dbs => 32
relay.loglevel => none
relay.logfile =>  
relay.session.compression => none
relay.session.compression_level => 0
relay.session.locking_enabled => 0
relay.session.lock_expire => 0
relay.session.lock_wait_time => 0

Environment

michael-grunder commented 5 months ago

The fix for this has been merged and will be in the next release.

tillkruss commented 5 months ago

Closing this.