回答編集履歴
1
微修正
answer
CHANGED
@@ -1,31 +1,33 @@
|
|
1
1
|
下記2行追加で削除することができました。
|
2
2
|
ありがとうございます。
|
3
3
|
|
4
|
+
削除サンプル
|
4
5
|
```delete
|
5
6
|
$cache = \Phalcon\Di::getDefault()->get("modelsCache");
|
6
7
|
$cache->delete($key);
|
7
8
|
```
|
8
9
|
|
10
|
+
モデル内での使用
|
9
11
|
```sample-model
|
10
12
|
public static function fetch($parameters=null, $lifetime=0, $key="")
|
11
|
-
|
13
|
+
{
|
12
|
-
|
14
|
+
// Convert the parameters to an array
|
13
|
-
|
15
|
+
if (!is_array($parameters)) {
|
14
|
-
|
16
|
+
$parameters = array($parameters);
|
15
|
-
|
17
|
+
}
|
16
18
|
|
17
|
-
|
19
|
+
// Some code...
|
18
20
|
|
19
|
-
|
21
|
+
// cache delete
|
20
|
-
|
22
|
+
$cache = \Phalcon\Di::getDefault()->get("modelsCache");
|
21
|
-
|
23
|
+
$cache->delete($key);
|
22
24
|
|
23
|
-
|
25
|
+
$parameters['cache'] = array(
|
24
|
-
|
26
|
+
"key" => $key,
|
25
|
-
|
27
|
+
"lifetime" => $lifetime
|
26
|
-
|
28
|
+
);
|
27
29
|
|
28
|
-
|
30
|
+
return parent::find($parameters);
|
29
|
-
|
31
|
+
}
|
30
32
|
|
31
|
-
```
|
33
|
+
```
|