From 7bdcc2ae157036965268c429423b31de5a9ea6bf Mon Sep 17 00:00:00 2001 From: El RIDO Date: Mon, 7 Jun 2021 07:02:47 +0200 Subject: [PATCH] conclude scaffolding of AbstractData key/value storage, missing implementation --- lib/Data/AbstractData.php | 6 ----- lib/Data/Database.php | 40 +++++++++++++++++++++++++++++++++ lib/Data/Filesystem.php | 15 ++++++++++++- lib/Data/GoogleCloudStorage.php | 40 +++++++++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 7 deletions(-) diff --git a/lib/Data/AbstractData.php b/lib/Data/AbstractData.php index 8a52d1d..0508bc0 100644 --- a/lib/Data/AbstractData.php +++ b/lib/Data/AbstractData.php @@ -28,12 +28,6 @@ abstract class AbstractData */ protected static $_instance = null; - protected static $_namespaces = array( - 'purge_limiter', - 'salt', - 'traffic_limiter', - ); - /** * Enforce singleton, disable constructor * diff --git a/lib/Data/Database.php b/lib/Data/Database.php index 607013b..5a0f369 100644 --- a/lib/Data/Database.php +++ b/lib/Data/Database.php @@ -423,6 +423,46 @@ class Database extends AbstractData ); } + /** + * Save a value. + * + * @access public + * @param string $value + * @param string $namespace + * @param string $key + * @return bool + */ + public function setValue($value, $namespace, $key = '') + { + switch ($namespace) { + case 'purge_limiter': + ; + break; + case 'salt': + ; + break; + case 'traffic_limiter': + ; + break; + default: + return false; + break; + } + } + + /** + * Load a value. + * + * @access public + * @param string $namespace + * @param string $key + * @return string + */ + public function getValue($namespace, $key = '') + { + + } + /** * Returns up to batch size number of paste ids that have expired * diff --git a/lib/Data/Filesystem.php b/lib/Data/Filesystem.php index fee61c1..76c2600 100644 --- a/lib/Data/Filesystem.php +++ b/lib/Data/Filesystem.php @@ -251,7 +251,20 @@ class Filesystem extends AbstractData */ public function setValue($value, $namespace, $key = '') { - + switch ($namespace) { + case 'purge_limiter': + ; + break; + case 'salt': + ; + break; + case 'traffic_limiter': + ; + break; + default: + return false; + break; + } } /** diff --git a/lib/Data/GoogleCloudStorage.php b/lib/Data/GoogleCloudStorage.php index 1a1d8bf..81fcce6 100644 --- a/lib/Data/GoogleCloudStorage.php +++ b/lib/Data/GoogleCloudStorage.php @@ -217,6 +217,46 @@ class GoogleCloudStorage extends AbstractData return $o->exists(); } + /** + * Save a value. + * + * @access public + * @param string $value + * @param string $namespace + * @param string $key + * @return bool + */ + public function setValue($value, $namespace, $key = '') + { + switch ($namespace) { + case 'purge_limiter': + ; + break; + case 'salt': + ; + break; + case 'traffic_limiter': + ; + break; + default: + return false; + break; + } + } + + /** + * Load a value. + * + * @access public + * @param string $namespace + * @param string $key + * @return string + */ + public function getValue($namespace, $key = '') + { + + } + /** * @inheritDoc */