Ubiquity
2.5.2
php rapid development framework
Loading...
Searching...
No Matches
CacheFile.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Ubiquity\cache
;
4
5
use
Ubiquity\utils\base\UFileSystem
;
6
7
class
CacheFile
{
8
private
$type
;
9
private
$name
;
10
private
$timestamp
;
11
private
$size
;
12
private
$file
;
13
14
public
function
__construct
(
$type
=
""
,
$name
=
""
,
$timestamp
= 0,
$size
= 0, $fileKey =
""
) {
15
$this->type =
$type
;
16
$this->name =
$name
;
17
$this->timestamp =
$timestamp
;
18
$this->size =
$size
;
19
$this->file = $fileKey;
20
}
21
22
public
static
function
initFromFiles
($folder,
$type
, $keyFunction =
null
) {
23
$files = UFileSystem::glob_recursive ( $folder . \DS .
'*'
);
24
$result = [ ];
25
if
(! isset ( $keyFunction )) {
26
$keyFunction =
function
(
$file
) {
27
return \basename (
$file
);
28
};
29
}
30
foreach
( $files as
$file
) {
31
if
(is_file (
$file
)) {
32
$result [] =
new
CacheFile
(
$type
, $keyFunction (
$file
), \filectime (
$file
), \filesize (
$file
),
$file
);
33
}
34
}
35
if
(\count ( $result ) == 0)
36
$result [] =
new
CacheFile
(
$type
,
""
,
""
,
""
,
""
);
37
return
$result;
38
}
39
40
public
static
function
delete
($folder) {
41
$files = UFileSystem::glob_recursive ( $folder . \DS .
'*'
);
42
foreach
( $files as
$file
) {
43
if
(is_file (
$file
)) {
44
\unlink (
$file
);
45
}
46
}
47
}
48
49
public
function
getName
() {
50
return
$this->name
;
51
}
52
53
public
function
setName
(
$name
) {
54
$this->name =
$name
;
55
return
$this;
56
}
57
58
public
function
getTimestamp
() {
59
return
$this->timestamp
;
60
}
61
62
public
function
setTimestamp
(
$timestamp
) {
63
$this->timestamp =
$timestamp
;
64
return
$this;
65
}
66
67
public
function
getSize
() {
68
return
$this->size
;
69
}
70
71
public
function
setSize
(
$size
) {
72
$this->size =
$size
;
73
return
$this;
74
}
75
76
public
function
getType
() {
77
return
$this->type
;
78
}
79
80
public
function
setType
(
$type
) {
81
$this->type =
$type
;
82
return
$this;
83
}
84
85
public
function
getFile
() {
86
return
$this->file
;
87
}
88
89
public
function
setFile
(
$file
) {
90
$this->file =
$file
;
91
return
$this;
92
}
93
}
Ubiquity\cache\CacheFile
Definition
CacheFile.php:7
Ubiquity\cache\CacheFile\setTimestamp
setTimestamp($timestamp)
Definition
CacheFile.php:62
Ubiquity\cache\CacheFile\$timestamp
$timestamp
Definition
CacheFile.php:10
Ubiquity\cache\CacheFile\setName
setName($name)
Definition
CacheFile.php:53
Ubiquity\cache\CacheFile\getName
getName()
Definition
CacheFile.php:49
Ubiquity\cache\CacheFile\getSize
getSize()
Definition
CacheFile.php:67
Ubiquity\cache\CacheFile\setFile
setFile($file)
Definition
CacheFile.php:89
Ubiquity\cache\CacheFile\getType
getType()
Definition
CacheFile.php:76
Ubiquity\cache\CacheFile\getTimestamp
getTimestamp()
Definition
CacheFile.php:58
Ubiquity\cache\CacheFile\$type
$type
Definition
CacheFile.php:8
Ubiquity\cache\CacheFile\initFromFiles
static initFromFiles($folder, $type, $keyFunction=null)
Definition
CacheFile.php:22
Ubiquity\cache\CacheFile\setSize
setSize($size)
Definition
CacheFile.php:71
Ubiquity\cache\CacheFile\$file
$file
Definition
CacheFile.php:12
Ubiquity\cache\CacheFile\$name
$name
Definition
CacheFile.php:9
Ubiquity\cache\CacheFile\__construct
__construct($type="", $name="", $timestamp=0, $size=0, $fileKey="")
Definition
CacheFile.php:14
Ubiquity\cache\CacheFile\setType
setType($type)
Definition
CacheFile.php:80
Ubiquity\cache\CacheFile\getFile
getFile()
Definition
CacheFile.php:85
Ubiquity\cache\CacheFile\$size
$size
Definition
CacheFile.php:11
Ubiquity\utils\base\UFileSystem
File system utilities Ubiquity\utils\base$UFileSystem This class is part of Ubiquity.
Definition
UFileSystem.php:16
Ubiquity\cache
Cache managment.
Definition
CacheFile.php:3
C:
Users
myadd
Documents
GitHub
ubiquity-doc-api
vendor
phpmv
ubiquity
src
Ubiquity
cache
CacheFile.php
Generated on Sun Dec 10 2023 15:04:11 for
Ubiquity
by
doxygen
1.9.8