FileCache
    
            
            in package
            
        
    
            
            implements
                            CacheInterface                    
    
    
        
            File‑based PSR‑16 cache store (PHP 7.4 compatible).
Each item is stored in a JSON file: { "expires_at": 0|unix‑timestamp, "value": mixed } The filename is <sha1(key)>.cache and is sharded into a two‑level directory tree to avoid huge single directories.
Interfaces, Classes, Traits and Enums
- CacheInterface
 
Table of Contents
- DIRECTORY_PERMISSION = 0775
 - Permission mask for created directories (respects UMASK).
 - KEY_PATTERN = '/^[A-Za-z0-9_.]+$/'
 - Allowed characters for keys (letters, numbers, underscore, dot).
 - MAX_KEY_LENGTH = 64
 - Maximum length allowed by PSR‑16 for a key.
 - $directory : string
 - Base cache directory (no trailing slash).
 - $fs : Filesystem
 - Symfony Filesystem wrapper.
 - __construct() : mixed
 - clear() : bool
 - delete() : bool
 - deleteMultiple() : bool
 - get() : mixed
 - getMultiple() : iteratable<string|int, mixed>
 - has() : bool
 - set() : bool
 - setMultiple() : bool
 - convertTtl() : int
 - Converts PSR‑16 TTL input to seconds.
 - getPath() : string
 - Returns full path for a given key, creating the shard directory if necessary. Sharding keeps each directory <256 files for perf.
 - validateKey() : void
 
Constants
DIRECTORY_PERMISSION
Permission mask for created directories (respects UMASK).
    private
        mixed
    DIRECTORY_PERMISSION
    = 0775
    
        
    
KEY_PATTERN
Allowed characters for keys (letters, numbers, underscore, dot).
    private
        mixed
    KEY_PATTERN
    = '/^[A-Za-z0-9_.]+$/'
    
        
    
MAX_KEY_LENGTH
Maximum length allowed by PSR‑16 for a key.
    private
        mixed
    MAX_KEY_LENGTH
    = 64
    
        
    
Properties
$directory
Base cache directory (no trailing slash).
    private
        string
    $directory
    
    
        
    
$fs
Symfony Filesystem wrapper.
    private
        Filesystem
    $fs
    
    
        
    
Methods
__construct()
    public
                    __construct(string $directory[, Filesystem|null $fs = null ]) : mixed
        
        Parameters
- $directory : string
 - $fs : Filesystem|null = null
 
Return values
mixed —clear()
    public
                    clear() : bool
        
    
    
        Return values
bool —delete()
    public
                    delete(mixed $key) : bool
        
        Parameters
- $key : mixed
 
Return values
bool —deleteMultiple()
    public
                    deleteMultiple(mixed $keys) : bool
        
        Parameters
- $keys : mixed
 
Return values
bool —get()
    public
                    get(mixed $key[, mixed $default = null ]) : mixed
        
        Parameters
- $key : mixed
 - $default : mixed = null
 
Return values
mixed —getMultiple()
    public
                    getMultiple(mixed $keys[, mixed $default = null ]) : iteratable<string|int, mixed>
        
        Parameters
- $keys : mixed
 - $default : mixed = null
 
Return values
iteratable<string|int, mixed> —has()
    public
                    has(mixed $key) : bool
        
        Parameters
- $key : mixed
 
Return values
bool —set()
    public
                    set(mixed $key, mixed $value[, mixed $ttl = null ]) : bool
        
        Parameters
- $key : mixed
 - $value : mixed
 - $ttl : mixed = null
 
Return values
bool —setMultiple()
    public
                    setMultiple(mixed $values[, mixed $ttl = null ]) : bool
        
        Parameters
- $values : mixed
 - $ttl : mixed = null
 
Return values
bool —convertTtl()
Converts PSR‑16 TTL input to seconds.
    private
                    convertTtl(mixed $ttl) : int
        null => 0 (no expiration) int => n (as given, may be negative) DI => computed seconds difference.
Parameters
- $ttl : mixed
 
Tags
Return values
int —getPath()
Returns full path for a given key, creating the shard directory if necessary. Sharding keeps each directory <256 files for perf.
    private
                    getPath(string $key) : string
    
        Parameters
- $key : string
 
Return values
string —validateKey()
    private
                    validateKey(mixed $key) : void
        
        Parameters
- $key : mixed