[Mapbender-commits] r9910 - trunk/mapbender/http/classes

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon May 28 05:48:51 PDT 2018


Author: armin11
Date: 2018-05-28 05:48:51 -0700 (Mon, 28 May 2018)
New Revision: 9910

Modified:
   trunk/mapbender/http/classes/class_cache.php
Log:
New option to use apcu as alternative to old apc user variable cache for php5.5+

Modified: trunk/mapbender/http/classes/class_cache.php
===================================================================
--- trunk/mapbender/http/classes/class_cache.php	2018-05-14 09:28:24 UTC (rev 9909)
+++ trunk/mapbender/http/classes/class_cache.php	2018-05-28 12:48:51 UTC (rev 9910)
@@ -40,6 +40,9 @@
 					case 'apc':
 						$this->isActive = true;
 					break;
+					case 'apcu':
+						$this->isActive = true;
+					break;
 				}
 			}
 		}
@@ -50,6 +53,9 @@
 			case "apc":
 				return apc_fetch($key);
 			break;
+			case "apcu":
+				return apcu_fetch($key);
+			break;
 			default:
 				return false;
 			break;
@@ -66,6 +72,10 @@
 					return (boolean)apc_fetch($key);
 				}
 			break;
+			//for php 5.5+ - debian 8 onwards
+			case "apcu":
+				return (boolean)apcu_fetch($key);
+			break;
 			default:
 				return false;
 			break;
@@ -87,6 +97,19 @@
 				}
 				return false;
 			break;
+			case "apcu":
+				$cache = apcu_cache_info('user');
+				if (empty($cache['cache_list'])) {
+       					return false;
+    				}
+				foreach ($cache['cache_list'] as $entry) {
+        				if ($entry['info'] != $key) {
+            					continue;
+        				}
+        				return $entry['creation_time'];
+				}
+				return false;
+			break;
 			default:
 				return false;
 			break;
@@ -99,6 +122,9 @@
 			case "apc":
 				return apc_add($key, $value, $ttl);
 			break;
+			case "apcu":
+				return apcu_add($key, $value, $ttl);
+			break;
 			default:
 				return false;
 			break;
@@ -110,6 +136,9 @@
 			case "apc":
 				return apc_delete($key);
 			break;
+			case "apcu":
+				return apcu_delete($key);
+			break;
 			default:
 				return false;
 			break;



More information about the Mapbender_commits mailing list