Beware of camels

This commit is contained in:
Michael 2017-06-06 17:42:47 +00:00
parent 611d3e3f5d
commit e3d5dcf049
1 changed files with 4 additions and 4 deletions

View File

@ -22,7 +22,7 @@ class Lock {
* *
* @return object|boolean The memcache object - or "false" if not successful * @return object|boolean The memcache object - or "false" if not successful
*/ */
private static function connect_memcache() { private static function connectMemcache() {
if (!function_exists('memcache_connect')) { if (!function_exists('memcache_connect')) {
return false; return false;
} }
@ -55,7 +55,7 @@ class Lock {
$got_lock = false; $got_lock = false;
$start = time(); $start = time();
$memcache = self::connect_memcache(); $memcache = self::connectMemcache();
if (is_object($memcache)) { if (is_object($memcache)) {
$wait_sec = 0.2; $wait_sec = 0.2;
$cachekey = get_app()->get_hostname().";lock:".$fn_name; $cachekey = get_app()->get_hostname().";lock:".$fn_name;
@ -126,7 +126,7 @@ class Lock {
* @param string $fn_name Name of the lock * @param string $fn_name Name of the lock
*/ */
public static function remove($fn_name) { public static function remove($fn_name) {
$memcache = self::connect_memcache(); $memcache = self::connectMemcache();
if (is_object($memcache)) { if (is_object($memcache)) {
$cachekey = get_app()->get_hostname().";lock:".$fn_name; $cachekey = get_app()->get_hostname().";lock:".$fn_name;
$lock = $memcache->get($cachekey); $lock = $memcache->get($cachekey);
@ -147,7 +147,7 @@ class Lock {
* @brief Removes all lock that were set by us * @brief Removes all lock that were set by us
*/ */
public static function removeAll() { public static function removeAll() {
$memcache = self::connect_memcache(); $memcache = self::connectMemcache();
if (is_object($memcache)) { if (is_object($memcache)) {
// We cannot delete all cache entries, but this doesn't matter with memcache // We cannot delete all cache entries, but this doesn't matter with memcache
return; return;