FilesCache class
Framework\Cache\FilesCache
Class FilesCache.
Extends Framework\Cache\Cache
Defined in libraries/cache/src/FilesCache.php
Properties #
- $configs
- Files Cache handler configurations.
- $baseDirectory
- -
$configs
protected array $configs = array (
'directory' => NULL,
'files_permission' => 420,
'gc' => 1,
)
Files Cache handler configurations.
$baseDirectory
protected ?string $baseDirectory
Methods #
- __construct()
- FilesCache constructor.
- __destruct()
- -
- delete()
- -
- flush()
- -
- gc()
- Garbage collector.
- get()
- -
- set()
- -
- setValue()
- -
- closeDir()
- -
- createSubDirectory()
- -
- deleteAll()
- -
- deleteExpired()
- -
- deleteFile()
- -
- getContents()
- -
- initialize()
- -
- openDir()
- -
- renderFilepath()
- -
- setBaseDirectory()
- -
- setGC()
- -
__construct()
public function __construct(?array $configs = array (
), ?string $prefix = NULL, \Framework\Cache\Serializer|string $serializer = \Framework\Cache\Serializer::PHP, ?\Framework\Log\Logger $logger = NULL)
FilesCache constructor.
Parameters
- ?array $configs - Driver specific configurations
- ?string $prefix - Keys prefix
- \Framework\Cache\Serializer|string $serializer - Data serializer
- ?\Framework\Log\Logger $logger - Logger instance
__destruct()
public function __destruct()
delete()
public function delete(string $key): bool
Parameters
- string $key
Returns
bool
flush()
public function flush(): bool
Returns
bool
gc()
public function gc(): bool
Garbage collector.
Deletes all expired items.
Returns
bool
- TRUE if all expired items was deleted, FALSE if a fail occurs
get()
public function get(string $key): mixed
Parameters
- string $key
Returns
mixed
set()
public function set(string $key, mixed $value, ?int $ttl = NULL): bool
Parameters
- string $key
- mixed $value
- ?int $ttl
Returns
bool
setValue()
public function setValue(string $key, mixed $value, ?int $ttl = NULL): bool
Parameters
- string $key
- mixed $value
- ?int $ttl
Returns
bool
closeDir()
protected function closeDir($resource): void
Parameters
- resource $resource
Returns
void
createSubDirectory()
protected function createSubDirectory(string $filepath): void
Parameters
- string $filepath
Returns
void
deleteAll()
protected function deleteAll(string $baseDirectory): bool
Parameters
- string $baseDirectory
Returns
bool
deleteExpired()
protected function deleteExpired(string $baseDirectory): bool
Parameters
- string $baseDirectory
Returns
bool
deleteFile()
protected function deleteFile(string $filepath): bool
Parameters
- string $filepath
Returns
bool
getContents()
protected function getContents(string $filepath): mixed
Parameters
- string $filepath
Returns
mixed
initialize()
protected function initialize(): void
Returns
void
openDir()
protected function openDir(string $dirpath)
Parameters
- string $dirpath
Returns
false|resource
renderFilepath()
protected function renderFilepath(string $key): string
Parameters
- string $key
Returns
string
setBaseDirectory()
protected function setBaseDirectory(): void
Returns
void
setGC()
protected function setGC(int $gc): void
Parameters
- int $gc
Returns
void
Inherited methods #
-
isAutoClose()fromFramework\Cache\Cache -
setAutoClose()fromFramework\Cache\Cache -
setConfigs()fromFramework\Cache\Cache -
setSerializer()fromFramework\Cache\Cache -
getSerializer()fromFramework\Cache\Cache -
log()fromFramework\Cache\Cache -
getDefaultTtl()fromFramework\Cache\Cache -
setDefaultTtl()fromFramework\Cache\Cache -
makeTtl()fromFramework\Cache\Cache -
getMulti()fromFramework\Cache\Cache -
setMulti()fromFramework\Cache\Cache -
deleteMulti()fromFramework\Cache\Cache -
increment()fromFramework\Cache\Cache -
decrement()fromFramework\Cache\Cache -
close()fromFramework\Cache\Cache -
renderKey()fromFramework\Cache\Cache -
serialize()fromFramework\Cache\Cache -
unserialize()fromFramework\Cache\Cache -
setDebugCollector()fromFramework\Cache\Cache -
addDebugGet()fromFramework\Cache\Cache -
addDebugSet()fromFramework\Cache\Cache -
addDebugDelete()fromFramework\Cache\Cache -
addDebugFlush()fromFramework\Cache\Cache