$cachePath
$cachePath : string
Full path to cache directory.
File system driver.
__construct(string $cachePath = '', integer $umask = 2)
Class constructor
string | $cachePath | Path to cache folder. It will be automatically create if not exists or throw an error if it stuck at some where. |
integer | $umask | See more at http://php.net/manual/en/function.umask.php |
createFolderIfNotExists(string $cachePath) : boolean
Create folder or path if it is not exists.
This method was called from __construct()
, set()
.
string | $cachePath | Path to check and create. |
Return true
if exists or created, return false
for otherwise.
deleteCacheSubfoldersIfEmpty(string $filepath) : boolean
Delete cache sub folder (recursively using `\FilesystemIterator`) if empty.
This method was called from delete()
.
string | $filepath | Path to cache sub folder. |
Return true
on success, false
if there is something error.
keyToPathAndFileName(string $key) : string
Convert key to path and file name.
For example: If key is "accounts.model.get_user_1" then it will be convert to accounts/model/get_user_1/md5(key)
This method was called from get()
, set()
, delete()
.
string | $key | The cache key |
Return the cache subfolders (if dot in the cache key exists) with file cache file name.
sanitizeFileName(string $string, boolean $forceLowerCase = false) : string
Returns a sanitized string, typically for URLs.
This method was called from keyToPathAndFileName()
.
string | $string | The string to sanitize. |
boolean | $forceLowerCase | Set to true to force the string to lowercase |
Sanitized string.