31 parent::__construct( $params );
34 $this->segmentationSize = $params[
'maxPreferedKeySize'] ?? 917504;
52 foreach (
$args as &$arg ) {
53 $arg = strtr( $arg,
' ',
'_' );
56 $arg = preg_replace_callback(
57 '/[^\x21-\x22\x24\x26-\x39\x3b-\x7e]+/',
59 return rawurlencode( $m[0] );
65 if ( $charsLeft > 33 && strlen( $arg ) > $charsLeft ) {
66 $arg =
'#' . md5( $arg );
69 $charsLeft -= strlen( $arg );
72 if ( $charsLeft < 0 ) {
73 return $keyspace .
':BagOStuff-long-key:##' . md5( implode(
':',
$args ) );
88 if ( preg_match(
'/[^\x21-\x7e]+/', $key ) ) {
89 throw new Exception(
"Key contains invalid characters: $key" );
108 $expiresAt = min( $exptime, self::TTL_MONTH );
110 $expiresAt = $exptime;
113 return (
int)$expiresAt;
Storage medium specific cache for storing items (e.g.
isRelativeExpiration( $exptime)
Base class for memcached clients.
makeKeyInternal( $keyspace, $args)
Construct a cache key.
validateKeyEncoding( $key)
Ensure that a key is safe to use (contains no control characters and no characters above the ASCII ra...
__construct(array $params)