File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -273,4 +273,58 @@ public function hVals($key): bool|array|Redis
273273
274274 return $ result ;
275275 }
276+
277+ /**
278+ * @param $key
279+ * @return int|false|Redis
280+ */
281+ public function getTTL ($ key ): bool |int |Redis
282+ {
283+ try {
284+ $ Redis = $ this ->getRedis ();
285+ $ result = $ Redis ->ttl ($ key );
286+ $ this ->putRedis ($ Redis );
287+ } catch (\Exception $ e ) {
288+ $ this ->addError ($ e ->getMessage ());
289+ return false ;
290+ }
291+
292+ return $ result ;
293+ }
294+
295+ /**
296+ * @return string|false|Redis
297+ */
298+ public function getLastError (): bool |string |Redis
299+ {
300+ try {
301+ $ Redis = $ this ->getRedis ();
302+ $ result = $ Redis ->getLastError ();
303+ $ this ->putRedis ($ Redis );
304+ } catch (\Exception $ e ) {
305+ $ this ->addError ($ e ->getMessage ());
306+ return false ;
307+ }
308+
309+ return $ result ;
310+ }
311+
312+ /**
313+ * @param $key
314+ * @param int $ttl
315+ * @return int|false|Redis
316+ */
317+ public function setExpire ($ key , int $ ttl ): bool |Redis
318+ {
319+ try {
320+ $ Redis = $ this ->getRedis ();
321+ $ result = $ Redis ->expire ($ key , $ ttl );
322+ $ this ->putRedis ($ Redis );
323+ } catch (\Exception $ e ) {
324+ $ this ->addError ($ e ->getMessage ());
325+ return false ;
326+ }
327+
328+ return $ result ;
329+ }
276330}
You can’t perform that action at this time.
0 commit comments