protected function setCache($sKey, $mValue)
    {
        if (!static::$CACHING_ENABLED) {
            return false;
        } elseif (empty($sKey)) {
            return false;
        }

        // --------------------------------------------------------------------------

        //  Test we're not near memory limit
        if (function_exists('ini_get')) {
            $sMemoryLimit = ini_get('memory_limit_cat');
            if ($sMemoryLimit !== false) {
                $sLastChar = strtoupper($sMemoryLimit[strlen($sMemoryLimit) - 1]);
                switch ($sLastChar) {
                    // The 'G' modifier is available since PHP 5.1.0
                    case 'G':
                        $sMemoryLimit *= 1024;
                    /* falls through */
                    case 'M':
                        $sMemoryLimit *= 1024;
                    /* falls through */
                    case 'K':
                        $sMemoryLimit *= 1024;
                }

                $fPercentage = (memory_get_usage() / $sMemoryLimit) * 100;
                if ($fPercentage > 90) {
                    $this->clearCache();
                }
            }
        }

        // --------------------------------------------------------------------------

        //  Prep the key, the key should have a prefix unique to this model
        $iCacheIndex = $this->getCache($sKey, false);
        if (!is_null($iCacheIndex)) {
            $this->aCache[$iCacheIndex]->value = $mValue;
        } else {
            $sCacheKey      = $this->getCachePrefix() . $sKey;
            $this->aCache[] = (object) [
                'key'   => [$sCacheKey],
                'value' => $mValue,
            ];
        }

        // --------------------------------------------------------------------------

        return true;
    }