@@ -51,11 +51,11 @@ class CacheManager
5151 /**
5252 * @var array
5353 */
54- public static $ config = [
54+ protected static $ config = [
5555 'default_chmod ' => 0777 , // 0777 recommended
5656 'fallback ' => 'files ' , //Fall back when old driver is not support
57- 'securityKey ' => 'auto ' ,
58- 'htaccess ' => true ,
57+ 'securityKey ' => 'auto ' ,// The securityKey that will be used to create sub-directory
58+ 'htaccess ' => true ,// Auto-generate .htaccess if tit is missing
5959 'path ' => '' ,// if not set will be the value of sys_get_temp_dir()
6060 "limited_memory_each_object " => 4096 , // maximum size (bytes) of object store in memory
6161 "compress_data " => false , // compress stored data, if the backend supports it
@@ -143,6 +143,7 @@ public static function clearInstances()
143143 unset($ instance );
144144 }
145145
146+ gc_collect_cycles ();
146147 return !count (self ::$ instances );
147148 }
148149
@@ -165,16 +166,37 @@ public static function setNamespacePath($path)
165166 /**
166167 * @param $name
167168 * @param string $value
169+ * @deprecated Method "setup" is deprecated and will be removed in 5.1. Use method "setDefaultConfig" instead.
168170 */
169171 public static function setup ($ name , $ value = '' )
172+ {
173+ trigger_error ('Method "setup" is deprecated and will be removed in 5.1. Use method "setDefaultConfig" instead. ' );
174+ self ::setDefaultConfig ($ name , $ value );
175+ }
176+
177+ /**
178+ * @param $name string|array
179+ * @param mixed $value
180+ */
181+ public static function setDefaultConfig ($ name , $ value = null )
170182 {
171183 if (is_array ($ name )) {
172184 self ::$ config = array_merge (self ::$ config , $ name );
173- } else {
185+ } else if ( is_string ( $ name )) {
174186 self ::$ config [ $ name ] = $ value ;
187+ }else {
188+ throw new \InvalidArgumentException ('Invalid variable type: $name ' );
175189 }
176190 }
177191
192+ /**
193+ * @return array
194+ */
195+ public function getDefaultConfig ()
196+ {
197+ return self ::$ config ;
198+ }
199+
178200 /**
179201 * @return array
180202 */
0 commit comments