/** * Removes entry from APC or flushes APC user entry storage * * @param mixed $keys Keys to clear, string or array */ protected function _clear(&$keys) { /* make an array if only one string is present, easier processing */ if (!is_array($keys)) { $keys = array($keys => true); } foreach ($keys as $key => $dummy) { if (!apc_delete($key)) { $this->log(sprintf(__translate__('Failed to delete APC entry: %s', 'wp-ffpc'), $key), LOG_WARNING); //throw new Exception ( __translate__('Deleting APC entry failed with key ', $this->plugin_constant ) . $key ); } else { $this->log(sprintf(__translate__('APC entry delete: %s', 'wp-ffpc'), $key)); } } }
/** * Removes entry from Memcached or flushes Memcached storage * * @param mixed $keys String / array of string of keys to delete entries with */ protected function _clear(&$keys) { /* make an array if only one string is present, easier processing */ if (!is_array($keys)) { $keys = array($keys => true); } foreach ($keys as $key => $dummy) { $kresult = $this->connection->delete($key); if ($kresult === false) { $this->log(sprintf(__translate__('unable to delete entry: %s', 'wp-ffpc'), $key)); } else { $this->log(sprintf(__translate__('entry deleted: %s', 'wp-ffpc'), $key)); } } }
/** * callback function to add settings link to plugins page * * @param array $links Current links to add ours to * */ public function plugin_settings_link($links) { $settings_link = '<a href="' . $this->settings_link . '">' . __translate__('Settings', 'wp-ffpc') . '</a>'; array_unshift($links, $settings_link); return $links; }
/** * function to check backend aliveness * * @return boolean true if backend is alive, false if not * */ protected function is_alive() { if (!$this->alive) { $this->log(__translate__("backend is not active, exiting function ", 'wp-ffpc') . __FUNCTION__, LOG_WARNING); return false; } return true; }
/** * Removes entry from Memcached or flushes Memcached storage * * @param mixed $keys String / array of string of keys to delete entries with */ protected function _clear(&$keys) { /* make an array if only one string is present, easier processing */ if (!is_array($keys)) { $keys = array($keys => true); } try { $kresult = $this->connection->delete($keys); } catch (Exception $e) { $this->log(sprintf(__translate__('unable to delete entry(s): %s', $this->plugin_constant), json_encode($key))); $this->log(sprintf(__translate__('Redis error: %s', $this->plugin_constant), json_encode($e))); } finally { $this->log(sprintf(__translate__('entry(s) deleted: %s', $this->plugin_constant), json_encode($keys))); } }