src/Comely/IO/Cache/Cache.php
public function setCacheableIdentifier(string $id = null, int $length = null): self
    {
        if ($id) {
            if (!preg_match('/^[a-zA-Z0-9\_\-\~\.]{8,32}$/', $id)) {
                throw new CacheException('Invalid value passed to "setCacheableIdentifier" method');
            }

            $this->cacheableId = $id;
            $this->cacheableIdLength = strlen($id);
        }

        if ($length) {
            if ($length < 100 || $length <= $this->cacheableIdLength) {
                throw new CacheException('Length of encoded Cacheable objects must start from at least 100');
            }

            $this->cacheableLengthFrom = $length;
        }

        return $this;
    }
public function setCacheableIdentifier(string $id = null, int $length = null): self
    {
        if ($id) {
            if (!preg_match('/^[a-zA-Z0-9\_\-\~\.]{8,32}$/', $id)) {
                throw new CacheException('Invalid value passed to "setCacheableIdentifier" method');
            }

            $this->cacheableId = $id;
            $this->cacheableIdLength = strlen($id);
        }

        if ($length) {
            if ($length < 100 || $length <= $this->cacheableIdLength) {
                throw new CacheException('Length of encoded Cacheable objects must start from at least 100');
            }

            $this->cacheableLengthFrom = $length;
        }

        return $this;
    }
public function setCacheableIdentifier ( string $ id = null , int $ length = null ) : self { if ( $ id ) { if ( ! preg_match ( '/^[a-zA-Z0-9\_\-\~\.]{8,32}$/' , $ id ) ) { throw new CacheException ( 'Invalid value passed to "setCacheableIdentifier" method' ) ; } $ this -> cacheableId = $ id ; $ this -> cacheableIdLength = strlen ( $ id ) ; } if ( $ length ) { if ( $ length < 100 || $ length <= $ this -> cacheableIdLength ) { throw new CacheException ( 'Length of encoded Cacheable objects must start from at least 100' ) ; } $ this -> cacheableLengthFrom = $ length ; } return $ this ; }
Set custom identifier for objects extending CacheableInterface

@param string|null $id
@param int|null $length
@return Cache
@throws CacheException
Set custom identifier for objects extending CacheableInterface