]> git.mxchange.org Git - core.git/blobdiff - framework/main/classes/database/frontend/class_BaseDatabaseFrontend.php
Continued:
[core.git] / framework / main / classes / database / frontend / class_BaseDatabaseFrontend.php
index b1e496634d9d5fe48f534e6a6d0841d11bef5572..f85f4badd2dac3bdbe8951a619c901abd7e91ff1 100644 (file)
@@ -89,6 +89,26 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem {
                return $this->tableName;
        }
 
+       /**
+        * Gets a cache key from Criteria instance
+        *
+        * @param       $criteriaInstance       An instance of a Criteria class
+        * @param       $onlyKeys                       Only use these keys for a cache key
+        * @return      $cacheKey                       A cache key suitable for lookup/storage purposes
+        */
+       protected function getCacheKeyByCriteria (Criteria $criteriaInstance, array $onlyKeys = []) {
+               // Generate it
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FRAMEWORK-SYSTEM: criteriaInstance=' . $criteriaInstance->__toString() . ',onlyKeys()=' . count($onlyKeys) . ' - CALLED!');
+               $cacheKey = sprintf('%s@%s',
+                       $this->__toString(),
+                       $criteriaInstance->getCacheKey($onlyKeys)
+               );
+
+               // And return it
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-FRAMEWORK-SYSTEM: cacheKey=' . $cacheKey . ' - EXIT!');
+               return $cacheKey;
+       }
+
        /**
         * 'Inserts' a data set instance into a local file database folder
         *