2121 * Class CacheOne
2222 *
2323 * @package eftec
24- * @version 2.19
24+ * @version 2.20
2525 * @link https://github.com/EFTEC/CacheOne
2626 * @author Jorge Patricio Castro Castillo <jcastro arroba eftec dot cl>
2727 * @license Dual License: Commercial and MIT
2828 */
2929class CacheOne
3030{
31- public const VERSION = "2.19 " ;
31+ public const VERSION = "2.20 " ;
3232 /** @var bool if true then it records every operation in $this::debugLog */
3333 public bool $ debug = false ;
3434 /** @var array If debug is true, then it records operations here. */
@@ -83,8 +83,8 @@ public function __construct(
8383 string $ user = "" ,
8484 string $ password = "" ,
8585 int $ timeout = 8 ,
86- int $ retry = null ,
87- int $ readTimeout = null
86+ ? int $ retry = null ,
87+ ? int $ readTimeout = null
8888 )
8989 {
9090 $ type = ($ type === 'document ' ) ? 'documentone ' : $ type ;
@@ -173,7 +173,7 @@ public function __construct(
173173 * It creates a new instance of CacheOne using an array
174174 * @param array $array =['type','server','schema','port','user','password','timeout','retry','readTimeout'][$i]<br>
175175 * it could be an associative array or an indexed array.
176- * @return void
176+ * @return CacheOne
177177 */
178178 public static function factory (array $ array ): CacheOne
179179 {
@@ -322,7 +322,7 @@ public function genCatId($group): string
322322 * @return mixed
323323 * @throws JsonException
324324 */
325- public function unserialize ($ input , string $ forcedSerializer = null )
325+ public function unserialize ($ input , ? string $ forcedSerializer = null )
326326 {
327327 if ($ input === false ) {
328328 return false ;
@@ -563,7 +563,7 @@ public function genId(string $key): string
563563 * @return bool
564564 * @throws Exception
565565 */
566- public function push ($ groups , string $ key , $ value , int $ duration = null , int $ limit = 0 , string $ limitStrategy = 'shiftold ' ): bool
566+ public function push ($ groups , string $ key , $ value , ? int $ duration = null , int $ limit = 0 , string $ limitStrategy = 'shiftold ' ): bool
567567 {
568568 return $ this ->executePushUnShift ('push ' , $ groups , $ key , $ value , $ duration , $ limit , $ limitStrategy );
569569 }
@@ -648,7 +648,7 @@ protected function executePushUnShift(string $type, $groups, string $key, $value
648648 * @return bool
649649 * @throws Exception
650650 */
651- public function unshift ($ groups , string $ key , $ value , int $ duration = null , int $ limit = 0 , string $ limitStrategy = 'popold ' ): bool
651+ public function unshift ($ groups , string $ key , $ value , ? int $ duration = null , int $ limit = 0 , string $ limitStrategy = 'popold ' ): bool
652652 {
653653 return $ this ->executePushUnShift ('unshift ' , $ groups , $ key , $ value , $ duration , $ limit , $ limitStrategy );
654654 }
@@ -676,7 +676,7 @@ public function unshift($groups, string $key, $value, int $duration = null, int
676676 * @throws Exception
677677 * @throws Exception
678678 */
679- public function pop ($ group , string $ key , $ defaultValue = PHP_INT_MAX , int $ duration = null )
679+ public function pop ($ group , string $ key , $ defaultValue = PHP_INT_MAX , ? int $ duration = null )
680680 {
681681 return $ this ->executePopShift ('pop ' , $ group , $ key , $ defaultValue , $ duration );
682682 }
@@ -691,7 +691,7 @@ public function pop($group, string $key, $defaultValue = PHP_INT_MAX, int $durat
691691 * @throws Exception
692692 * @throws Exception
693693 */
694- protected function executePopShift (string $ type , $ group , string $ key , $ defaultValue = PHP_INT_MAX , int $ duration = null )
694+ protected function executePopShift (string $ type , $ group , string $ key , $ defaultValue = PHP_INT_MAX , ? int $ duration = null )
695695 {
696696 $ defaultValue = $ defaultValue === PHP_INT_MAX ? $ this ->defaultValue : $ defaultValue ;
697697 if (!$ this ->enabled ) {
@@ -736,7 +736,7 @@ protected function executePopShift(string $type, $group, string $key, $defaultVa
736736 * @throws Exception
737737 * @throws Exception
738738 */
739- public function shift ($ group , string $ key , $ defaultValue = PHP_INT_MAX , int $ duration = null )
739+ public function shift ($ group , string $ key , $ defaultValue = PHP_INT_MAX , ? int $ duration = null )
740740 {
741741 return $ this ->executePopShift ('shift ' , $ group , $ key , $ defaultValue , $ duration );
742742 }
0 commit comments