FileStorage
扩展 CacheStorage文件缓存存储处理程序
| 自 |
1.7.0 |
|---|---|
| 注意 |
出于性能原因,此类不使用文件系统包的 API |
| 包 |
Joomla CMS |
方法
__construct
构造函数
__construct(mixed||string|int options = []) :
| 自 |
1.7.0 |
|---|
参数
- options
array<string|int, mixed>可选参数
响应
mixed
_checkExpire
检查缓存对象是否已过期
_checkExpire( id, group) :
在这里使用 @ 错误抑制器,因为如果我们先执行了 file_exists(),然后执行了 filemsize(),那么在另一个进程可以删除文件的那段时间内,就会出现 PHP 警告。
| 自 |
1.7.0 |
|---|
参数
- id
string要检查的缓存 ID- group
string缓存数据组
响应
bool如果缓存 ID 有效,则为 True
_cleanPath
从路径名中删除额外的 / 或 \ 的函数
_cleanPath( path, ds = DIRECTORY_SEPARATOR) :
| 自 |
1.7.0 |
|---|
参数
- path
string要清理的路径- ds
string目录分隔符(可选)
响应
string已清理的路径
_deleteFolder
快速删除文件文件夹
_deleteFolder( path) :
| 自 |
1.7.0 |
|---|
参数
- path
string要删除的文件夹的路径。
响应
bool
_filesInFolder
快速读取文件夹中文件的实用程序函数。
_filesInFolder( path, filter = '.', recurse = false, fullpath = false, mixed||string|int exclude = ['.svn', 'CVS', '.DS_Store', '__MACOSX'], mixed||string|int excludefilter = ['^..*', '.*~']) : mixed||string|int
| 自 |
1.7.0 |
|---|
参数
- path
string要读取的文件夹的路径。- filter
string文件名过滤器。- recurse
mixedTrue 表示递归搜索子文件夹,或整数表示最大深度。- fullpath
boolTrue 表示返回文件的完整路径。- exclude
array<string|int, mixed>包含不应显示在结果中的文件名数组。- excludefilter
array<string|int, mixed>要排除的文件夹名称数组
响应
array<string|int, mixed>给定文件夹中的文件。
_folders
读取文件夹中文件夹的实用程序函数。
_folders( path, filter = '.', recurse = false, fullpath = false, mixed||string|int exclude = ['.svn', 'CVS', '.DS_Store', '__MACOSX'], mixed||string|int excludefilter = ['^..*']) : mixed||string|int
| 自 |
1.7.0 |
|---|
参数
- path
string要读取的文件夹的路径。- filter
string文件夹名称过滤器。- recurse
mixedTrue 表示递归搜索子文件夹,或整数表示最大深度。- fullpath
boolTrue 表示返回文件夹的完整路径。- exclude
array<string|int, mixed>包含不应显示在结果中的文件夹名称数组。- excludefilter
array<string|int, mixed>包含与不应显示在结果中的文件夹匹配的正则表达式数组。
响应
array<string|int, mixed>给定文件夹中的文件夹。
_getCacheId
从 ID/组对获取缓存 ID 字符串
_getCacheId( id, group) :
| 自 |
1.7.0 |
|---|
参数
- id
string缓存数据 ID- group
string缓存数据组
响应
string
_getFilePath
从 ID/组对获取缓存文件路径
_getFilePath( id, group) : bool|string
| 自 |
1.7.0 |
|---|
参数
- id
string缓存数据 ID- group
string缓存数据组
响应
bool|string数据对象的路径,如果缓存目录不存在,则为布尔值 false
addIncludePath
添加 CacheStorage 应在其中搜索处理程序的目录。您可以传递字符串或目录数组。
addIncludePath(array|string path = '') : mixed||string|int
| 自 |
1.7.0 |
|---|
参数
- path
array<string|int, mixed>|string要搜索的路径。
响应
array<string|int, mixed>包含目录元素的数组
clean
清理给定模式的组的缓存。
clean( group, mode = null) :
group 模式:清理组中所有缓存 notgroup 模式:清理组外所有缓存
| 自 |
1.7.0 |
|---|
参数
- group
string缓存数据组- mode
string用于清理缓存的模式 [group|notgroup]
响应
bool
contains
检查缓存是否包含由 ID 和组存储的数据
contains( id, group) :
| 自 |
3.7.0 |
|---|
参数
- id
string缓存数据 ID- group
string缓存数据组
响应
bool
flush
刷新存储中的所有现有项目。
flush() :
| 自 |
3.6.3 |
|---|
响应
bool
gc
垃圾回收已过期的缓存数据
gc() :
| 自 |
1.7.0 |
|---|
响应
bool
get
通过 ID 和组获取缓存数据
get( id, group, checkTime = true) :
| 自 |
1.7.0 |
|---|
参数
- id
string缓存数据 ID- group
string缓存数据组- checkTime
boolTrue 表示验证缓存时间过期阈值
响应
mixed如果失败,则为布尔值 false,否则为缓存数据对象
getAll
获取所有缓存数据
getAll() :
| 自 |
1.7.0 |
|---|
响应
mixed如果失败,则为布尔值 false,否则为缓存数据对象
getInstance
返回缓存存储处理程序对象。
getInstance( handler = null, mixed||string|int options = []) : \Joomla\CMS\Cache\CacheStorage
| 自 |
1.7.0 |
|---|---|
| throws |
|
参数
- handler
string要实例化的缓存存储处理程序- options
array<string|int, mixed>处理程序选项数组
响应
isSupported
测试存储处理程序是否可用。
isSupported() :
| 自 |
3.0.0 |
|---|
响应
bool
lock
锁定缓存的项目
lock( id, group, locktime) :
| 自 |
1.7.0 |
|---|
参数
- id
string缓存数据 ID- group
string缓存数据组- locktime
int缓存项目最大锁定时间
响应
mixed如果锁定失败,则为布尔值 false,否则为包含 lock 和 locklooped 属性的对象
remove
通过 ID 和组删除缓存的数据条目
remove( id, group) :
| 自 |
1.7.0 |
|---|
参数
- id
string缓存数据 ID- group
string缓存数据组
响应
bool
store
通过 ID 和组将数据存储到缓存中
store( id, group, data) :
| 自 |
1.7.0 |
|---|
参数
- id
string缓存数据 ID- group
string缓存数据组- data
string要存储在缓存中的数据
响应
bool
unlock
解锁缓存的项目
unlock( id, group = null) :
| 自 |
1.7.0 |
|---|
参数
- id
string缓存数据 ID- group
string缓存数据组
响应
bool
属性
rawname
原始对象名称
| 自 |
1.7.0 |
|---|
类型
string
_now
实例化缓存存储处理程序的时间
| 自 |
1.7.0 |
|---|
类型
int
_lifetime
缓存生存期
| 自 |
1.7.0 |
|---|
类型
int
_locking
是否启用锁定的标志
| 自 |
1.7.0 |
|---|
类型
bool
_language
语言代码
| 自 |
1.7.0 |
|---|
类型
string
_application
应用程序名称
| 自 |
1.7.0 |
|---|
类型
string
_hash
对象哈希
| 自 |
1.7.0 |
|---|
类型
string
_threshold
阈值
| 自 |
4.3.0 |
|---|
类型
int
_root
根路径
| 自 |
1.7.0 |
|---|
类型
string
_locked_files
已锁定的资源
| 自 |
3.7.0 |
|---|
类型
array<string|int, mixed>