1414
1515use phpFastCache \CacheManager ;
1616define ('PHP_EXT ' , substr (strrchr (__FILE__ , '. ' ), 1 ));
17- /**
18- * Register Autoload
19- */
20- spl_autoload_register (function ($ entity ) {
21- // Explode is faster than substr & strstr also more control
22- $ module = explode ('\\' ,$ entity ,2 );
23- if ($ module [0 ] !== 'phpFastCache ' ) {
24- /**
25- * Not a part of phpFastCache file
26- * then we return here.
27- */
28- return ;
29- }
3017
31- $ entity = str_replace ('\\' , '/ ' , $ module [1 ]);
32- $ path = __DIR__ . '/ ' . $ entity . '. ' . PHP_EXT ;
33- if (is_readable ($ path )) {
34- require_once $ path ;
35- }
36- });
18+ if (!defined ("PHPFASTCACHE_LEGACY " )) {
19+ /**
20+ * Register Autoload
21+ */
22+ spl_autoload_register (function ($ entity ) {
23+ // Explode is faster than substr & strstr also more control
24+ $ module = explode ('\\' ,$ entity ,2 );
25+ if ($ module [0 ] !== 'phpFastCache ' ) {
26+ /**
27+ * Not a part of phpFastCache file
28+ * then we return here.
29+ */
30+ return ;
31+ }
32+
33+ $ entity = str_replace ('\\' , '/ ' , $ module [1 ]);
34+ $ path = __DIR__ . '/ ' . $ entity . '. ' . PHP_EXT ;
35+ if (is_readable ($ path )) {
36+ require_once $ path ;
37+ }
38+ });
39+
40+ } else {
41+ require_once __DIR__ .'/Util/Legacy.php ' ;
42+ }
3743
3844/**
3945 * phpFastCache() Full alias
@@ -47,15 +53,3 @@ function phpFastCache($storage = 'auto', $config = array())
4753 return CacheManager::getInstance ($ storage , $ config );
4854 }
4955}
50- /**
51- * __c() Short alias
52- * @param string $storage
53- * @param array $config
54- * @return mixed
55- */
56- if (!function_exists ("__c " )) {
57- function __c ($ storage = 'auto ' , $ config = array ())
58- {
59- return CacheManager::getInstance ($ storage , $ config );
60- }
61- }
0 commit comments