+ // Is the cache enabled?
+ if ($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === TRUE) {
+ // Set the new instance
+ $this->cacheInstance = CacheFactory::getFactory()->createConfiguredCache();
+ } // END - if
+ }
+
+ /**
+ * Setter for table name
+ *
+ * @param $tableName Name of table name to set
+ * @return void
+ */
+ protected final function setTableName ($tableName) {
+ $this->tableName = (string) $tableName;
+ }
+
+ /**
+ * Getter for table name
+ *
+ * @return $tableName Name of table name to set
+ */
+ protected final function getTableName () {
+ return $this->tableName;
+ }
+
+ /**
+ * 'Inserts' a data set instance into a local file database folder
+ *
+ * @param $dataSetInstance A storeable data set
+ * @param $onlyKeys Only use these keys for a cache key
+ * @return void
+ */
+ protected function queryInsertDataSet (StoreableCriteria $dataSetInstance, array $onlyKeys = array()) {
+ // Default cache key is NULL
+ $cacheKey = NULL;
+
+ // Is cache enabled?
+ if ($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === TRUE) {
+ // First get a key suitable for our cache and extend it with this class name
+ $cacheKey = $this->getCacheKeyByCriteria($dataSetInstance, $onlyKeys);
+ //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('BASE-WRAPPER: Using cache key ' . $cacheKey . ' for purging ...');
+ } // END - if
+
+ // Does this key exists in cache?
+ if (($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === TRUE) && ($this->cacheInstance->offsetExists($cacheKey))) {
+ // Purge the cache
+ $this->cacheInstance->purgeOffset($cacheKey);
+ } // END - if
+
+ // Handle it over to the middleware
+ $this->getDatabaseInstance()->queryInsertDataSet($dataSetInstance);
+ }
+
+ /**
+ * 'Updates' a data set instance with a database layer
+ *
+ * @param $dataSetInstance A storeable data set
+ * @param $onlyKeys Only use these keys for a cache key
+ * @return void
+ */
+ protected function queryUpdateDataSet (StoreableCriteria $dataSetInstance, array $onlyKeys = array()) {
+ // Init cache key
+ $cacheKey = NULL;
+
+ // Is cache enabled?
+ if ($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === TRUE) {
+ // First get a key suitable for our cache and extend it with this class name
+ $cacheKey = $this->getCacheKeyByCriteria($dataSetInstance, $onlyKeys);
+ //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('BASE-WRAPPER: Using cache key ' . $cacheKey . ' for purging ...');
+ } // END - if
+
+ // Does this key exists in cache?
+ if (($this->getConfigInstance()->getConfigEntry('database_cache_enabled') === TRUE) && ($this->cacheInstance->offsetExists($cacheKey))) {
+ // Purge the cache
+ $this->cacheInstance->purgeOffset($cacheKey);
+ } // END - if
+
+ // Handle it over to the middleware
+ $this->getDatabaseInstance()->queryUpdateDataSet($dataSetInstance);
+ }
+
+ /**
+ * Getter for index key
+ *
+ * @return $indexKey Index key
+ */
+ public final function getIndexKey () {
+ return $this->getDatabaseInstance()->getIndexKey();
+ }
+
+ /**
+ * Getter for last exception
+ *
+ * @return $lastException Last exception or NULL if none occured
+ */
+ public final function getLastException () {
+ return $this->getDatabaseInstance()->getLastException();