Skip to content

Commit 3ff7d15

Browse files
committed
Created migration directory
1 parent 6bde602 commit 3ff7d15

2 files changed

Lines changed: 137 additions & 0 deletions

File tree

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
Because the V5 is not backward compatible with the V4 we will help you to migrate your code:
2+
3+
4+
### Extending phpFastCache:
5+
6+
#### :clock1: Then:
7+
```php
8+
namespace My\Custom\Project;
9+
use phpFastCache\Core\phpFastCache;
10+
11+
/**
12+
* Class Cache
13+
*/
14+
class Cache extends phpFastCache
15+
{
16+
17+
}
18+
```
19+
20+
#### :alarm_clock: Now:
21+
22+
```php
23+
namespace My\Custom\Project;
24+
use phpFastCache\Proxy\phpFastCacheAbstractProxy;
25+
26+
/**
27+
* Class Cache
28+
*/
29+
class Cache extends phpFastCacheAbstractProxy
30+
{
31+
32+
}
33+
```
34+
35+
See examples/extendedPhpFastCache.php for more informations
36+
37+
38+
39+
### Get/Set uses:
40+
41+
#### :clock1: Then:
42+
```php
43+
namespace My\Custom\Project;
44+
use phpFastCache\Core\phpFastCache;
45+
46+
$cache = phpFastCache();
47+
// or
48+
$cache = __c();
49+
50+
$myCacheItem = $cache->get("myKey");
51+
52+
if($myCacheItem === null){
53+
$myCacheItem = database_operation();
54+
$cache->set("myKey", $myCacheItem, 600);
55+
}
56+
57+
58+
$template['myCacheItemData'] = $myCacheItem;
59+
```
60+
61+
#### :alarm_clock: Now:
62+
63+
```php
64+
namespace My\Custom\Project;
65+
66+
$config = [
67+
'path' => 'An\absolute\path',
68+
];
69+
$cache = CacheManager::getInstance('Files', $config);
70+
// or
71+
$cache = CacheManager::Files($config);
72+
73+
$myCacheItem = $cache->getItem("myKey");
74+
75+
if(!$myCacheItem->isHit()){
76+
$myCacheItem->set(database_operation());
77+
$cache->save($myCacheItem);
78+
}
79+
80+
$template['myCacheItemData'] = $myCacheItem->get();
81+
```
82+
83+
84+
85+
86+
87+
88+
89+
90+
91+
92+
93+
### Cache clearing:
94+
95+
#### :clock1: Then:
96+
```php
97+
namespace My\Custom\Project;
98+
use phpFastCache\Core\phpFastCache;
99+
100+
$cache = phpFastCache();
101+
// or
102+
$cache = __c();
103+
104+
$cache->clean();
105+
```
106+
107+
#### :alarm_clock: Now:
108+
109+
```php
110+
namespace My\Custom\Project;
111+
112+
$config = [
113+
'path' => 'An\absolute\path',
114+
];
115+
$cache = CacheManager::getInstance('Files', $config);
116+
// or
117+
$cache = CacheManager::Files($config);
118+
119+
$myCacheItem = $cache->clear();
120+
121+
```
122+
123+
124+
125+
126+
127+
128+
129+
130+
131+
132+
133+
134+
### Search system:
135+
The search system has been removed in favor of Tags features. Remember that the cache must NOT be considered as a search engine like Solr, Sphynx etc.
136+
137+
See examples/tagsMethods.php for more information
File renamed without changes.

0 commit comments

Comments
 (0)