download all files

This commit is contained in:
Roman Pyrih
2025-06-24 14:14:35 +02:00
parent ebed09c00b
commit 4c71b5d9c2
72007 changed files with 10407727 additions and 40029 deletions

View File

@@ -0,0 +1,29 @@
<?php
/**
* Redis Cache
* Version: 2.1.1
* Copyright (c) 2020-2022. Mateusz Szymański Teamwant
* https://teamwant.pl
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
* @author Teamwant <kontakt@teamwant.pl>
* @copyright Copyright 2020-2023 © Teamwant Mateusz Szymański All right reserved
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* @category Teamwant
* @package Teamwant
*/
class Context extends ContextCore
{
public $disableCacheForOrderPage_initialized = false;
public $disableCacheForOrderPage = false;
public $disableCacheForAddressPaymentAndCarrier_initialized = false;
public $disableCacheForAddressPaymentAndCarrier = false;
}

View File

@@ -0,0 +1,37 @@
<?php
/**
* Redis Cache
* Version: 2.1.1
* Copyright (c) 2020-2022. Mateusz Szymański Teamwant
* https://teamwant.pl
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
* @author Teamwant <kontakt@teamwant.pl>
* @copyright Copyright 2020-2023 © Teamwant Mateusz Szymański All right reserved
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* @category Teamwant
* @package Teamwant
*/
class Dispatcher extends DispatcherCore
{
public static function teamwantRedisGetAvailableCachingType()
{
return [
'CacheRedis' => 'Redis'
];
}
public static function teamwantRedisGetExtensionsListCachingType()
{
return [
'Redis' => []
];
}
}

View File

@@ -0,0 +1,257 @@
<?php
/**
* Redis Cache
* Version: 2.1.1
* Copyright (c) 2020-2022. Mateusz Szymański Teamwant
* https://teamwant.pl
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
* @author Teamwant <kontakt@teamwant.pl>
* @copyright Copyright 2020-2023 © Teamwant Mateusz Szymański All right reserved
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* @category Teamwant
* @package Teamwant
*/
abstract class ObjectModel extends ObjectModelCore
{
public function update($null_values = false)
{
$r = parent::update($null_values);
$this->overrideObjectCache();
$this->clearCache();
if (
Tools::getValue('submitAddress')
|| (Tools::getValue('id_address') && Tools::getValue('delete'))
|| (Tools::getValue('id_address') && Tools::getValue('deleteAddress'))
) {
$this->clearCustomerDataAfterUpdate();
}
return $r;
}
public function add($auto_date = true, $null_values = false)
{
$r = parent::add($auto_date, $null_values);
$this->overrideObjectCache();
$this->clearCache();
if (
Tools::getValue('submitAddress')
|| (Tools::getValue('id_address') && Tools::getValue('delete'))
|| (Tools::getValue('id_address') && Tools::getValue('deleteAddress'))
) {
$this->clearCustomerDataAfterUpdate();
}
return $r;
}
public function delete()
{
$r = parent::delete();
$this->clearObjectCache();
$this->clearCache();
if (
Tools::getValue('submitAddress')
|| (Tools::getValue('id_address') && Tools::getValue('delete'))
|| (Tools::getValue('id_address') && Tools::getValue('deleteAddress'))
) {
$this->clearCustomerDataAfterUpdate();
}
return $r;
}
public function clearObjectCache()
{
try {
if ($this->id) {
$cache = Cache::getInstance();
if ($cache instanceof \Teamwant\Prestashop17\Redis\Classes\Cache\Redis) {
$id = $this->id;
$id_lang = $this->id_lang;
$entity = $this;
$entity_defs = $this->def;
$id_shop = $this->id_shop;
$should_cache_objects = self::$cache_objects;
$sql = new DbQuery();
$sql->from($entity_defs['table'], 'a');
$sql->where('a.`' . bqSQL($entity_defs['primary']) . '` = ' . (int)$id);
if ($id_lang && isset($entity_defs['multilang']) && $entity_defs['multilang']) {
$sql->leftJoin($entity_defs['table'] . '_lang', 'b', 'a.`' . bqSQL($entity_defs['primary']) . '` = b.`' . bqSQL($entity_defs['primary']) . '` AND b.`id_lang` = ' . (int)$id_lang);
if ($id_shop && !empty($entity_defs['multilang_shop'])) {
$sql->where('b.`id_shop` = ' . (int)$id_shop);
}
}
if (Shop::isTableAssociated($entity_defs['table'])) {
$sql->leftJoin($entity_defs['table'] . '_shop', 'c', 'a.`' . bqSQL($entity_defs['primary']) . '` = c.`' . bqSQL($entity_defs['primary']) . '` AND c.`id_shop` = ' . (int)$id_shop);
}
if ($sql instanceof DbQuery) {
$sql = $sql->build();
}
$sql = rtrim($sql, " \t\n\r\0\x0B;") . ' LIMIT 1';
$cache->clearQuery($sql);
if (!$id_lang && isset($entity_defs['multilang']) && $entity_defs['multilang']) {
$sql = 'SELECT *
FROM `' . bqSQL(_DB_PREFIX_ . $entity_defs['table']) . '_lang`
WHERE `' . bqSQL($entity_defs['primary']) . '` = ' . (int)$id
. (($id_shop && $entity->isLangMultishop()) ? ' AND `id_shop` = ' . (int)$id_shop : '');
if ($sql instanceof DbQuery) {
$sql = $sql->build();
}
$cache->clearQuery($sql);
}
}
}
} catch (Throwable $e) {
}
}
public function overrideObjectCache()
{
try {
if ($this->id) {
$cache = Cache::getInstance();
if ($cache instanceof \Teamwant\Prestashop17\Redis\Classes\Cache\Redis) {
$id = $this->id;
$id_lang = $this->id_lang;
//$entity = $this;
$className = get_class($this);
$entity = (new $className);
$entity_defs = ObjectModel::getDefinition($className);;
$id_shop = $this->id_shop;
$should_cache_objects = self::$cache_objects;
$cache_id = 'objectmodel_' . $entity_defs['classname'] . '_' . (int)$id . '_' . (int)$id_shop . '_' . (int)$id_lang;
$sql = new DbQuery();
$sql->from($entity_defs['table'], 'a');
$sql->where('a.`' . bqSQL($entity_defs['primary']) . '` = ' . (int)$id);
if ($id_lang && isset($entity_defs['multilang']) && $entity_defs['multilang']) {
$sql->leftJoin($entity_defs['table'] . '_lang', 'b', 'a.`' . bqSQL($entity_defs['primary']) . '` = b.`' . bqSQL($entity_defs['primary']) . '` AND b.`id_lang` = ' . (int)$id_lang);
if ($id_shop && !empty($entity_defs['multilang_shop'])) {
$sql->where('b.`id_shop` = ' . (int)$id_shop);
}
}
if (Shop::isTableAssociated($entity_defs['table'])) {
$sql->leftJoin($entity_defs['table'] . '_shop', 'c', 'a.`' . bqSQL($entity_defs['primary']) . '` = c.`' . bqSQL($entity_defs['primary']) . '` AND c.`id_shop` = ' . (int)$id_shop);
}
if ($object_datas = Db::getInstance()->getRow($sql, false)) {
if ($sql instanceof DbQuery) {
$sql = $sql->build();
}
$sql = rtrim($sql, " \t\n\r\0\x0B;") . ' LIMIT 1';
Cache::getInstance()->setQuery($sql, $object_datas);
$objectVars = get_object_vars($entity);
if (!$id_lang && isset($entity_defs['multilang']) && $entity_defs['multilang']) {
$sql = 'SELECT *
FROM `' . bqSQL(_DB_PREFIX_ . $entity_defs['table']) . '_lang`
WHERE `' . bqSQL($entity_defs['primary']) . '` = ' . (int)$id
. (($id_shop && $entity->isLangMultishop()) ? ' AND `id_shop` = ' . (int)$id_shop : '');
if ($object_datas_lang = Db::getInstance()->executeS($sql, true, false)) {
if ($sql instanceof DbQuery) {
$sql = $sql->build();
}
Cache::getInstance()->setQuery($sql, $object_datas_lang);
foreach ($object_datas_lang as $row) {
foreach ($row as $key => $value) {
if ($key != $entity_defs['primary'] && array_key_exists($key, $objectVars)) {
if (!isset($object_datas[$key]) || !is_array($object_datas[$key])) {
$object_datas[$key] = [];
}
$object_datas[$key][$row['id_lang']] = $value;
}
}
}
}
}
$entity->id = (int)$id;
foreach ($object_datas as $key => $value) {
if (array_key_exists($key, $entity_defs['fields']) || $key == $entity_defs['primary']) {
$entity->{$key} = $value;
} else {
unset($object_datas[$key]);
}
}
if ($should_cache_objects) {
Cache::store($cache_id, $object_datas);
}
}
}
}
} catch (Throwable $e) {
}
}
public function clearCustomerDataAfterUpdate()
{
try {
$cache = Cache::getInstance();
if ($cache instanceof \Teamwant\Prestashop17\Redis\Classes\Cache\Redis) {
$n = new CustomerSession(Context::getContext()->customer->id);
$n->clearObjectCache();
$n = new Customer(Context::getContext()->customer->id);
$n->clearObjectCache();
}
} catch (Throwable $e) {
}
try {
$cache = Cache::getInstance();
if ($cache instanceof \Teamwant\Prestashop17\Redis\Classes\Cache\Redis) {
if ($this->id) {
$id_lang = Context::getContext()->language->id;
$customer = Context::getContext()->customer;
if ($customer->id) {
$group = Context::getContext()->shop->getGroup();
$shareOrder = isset($group->share_order) ? (bool)$group->share_order : false;
$sql = 'SELECT DISTINCT a.*, cl.`name` AS country, s.name AS state, s.iso_code AS state_iso
FROM `' . _DB_PREFIX_ . 'address` a
LEFT JOIN `' . _DB_PREFIX_ . 'country` c ON (a.`id_country` = c.`id_country`)
LEFT JOIN `' . _DB_PREFIX_ . 'country_lang` cl ON (c.`id_country` = cl.`id_country`)
LEFT JOIN `' . _DB_PREFIX_ . 'state` s ON (s.`id_state` = a.`id_state`)
' . ($shareOrder ? '' : Shop::addSqlAssociation('country', 'c')) . '
WHERE `id_lang` = ' . (int)$id_lang . ' AND `id_customer` = ' . (int)$customer->id . ' AND a.`deleted` = 0';
$cache->delete($cache->getQueryHash($sql));
}
}
}
} catch (Throwable $e) {
}
try {
$cache = Cache::getInstance();
if ($cache instanceof \Teamwant\Prestashop17\Redis\Classes\Cache\Redis) {
if ($this->id) {
$id_lang = Context::getContext()->language->id;
$customer = Context::getContext()->customer;
if ($customer->id) {
$sql = $customer->getSimpleAddressSql(null, $id_lang);
$cache->delete($cache->getQueryHash($sql));
$cache->delete($sql);
}
}
}
} catch (Throwable $e) {
}
}
}

View File

@@ -0,0 +1,44 @@
<?php
/**
* Redis Cache
* Version: 2.1.1
* Copyright (c) 2020-2022. Mateusz Szymański Teamwant
* https://teamwant.pl
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
* @author Teamwant <kontakt@teamwant.pl>
* @copyright Copyright 2020-2023 © Teamwant Mateusz Szymański All right reserved
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* @category Teamwant
* @package Teamwant
*/
abstract class Cache extends CacheCore
{
/**
* @return Cache
*/
public static function getInstance()
{
if (!self::$instance) {
$caching_system = _PS_CACHING_SYSTEM_;
if ($caching_system === 'Redis') {
if (!class_exists(\Teamwant\Prestashop17\Redis\Classes\Cache\Redis::class)) {
require_once _PS_MODULE_DIR_ . 'teamwant_redis/vendor/autoload.php';
}
$caching_system = \Teamwant\Prestashop17\Redis\Classes\Cache\Redis::class;
}
self::$instance = new $caching_system();
}
return self::$instance;
}
}

View File

@@ -0,0 +1,30 @@
<?php
/**
* Redis Cache
* Version: 2.1.1
* Copyright (c) 2020-2022. Mateusz Szymański Teamwant
* https://teamwant.pl
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
* @author Teamwant <kontakt@teamwant.pl>
* @copyright Copyright 2020-2023 © Teamwant Mateusz Szymański All right reserved
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* @category Teamwant
* @package Teamwant
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,30 @@
<?php
/**
* Redis Cache
* Version: 2.1.1
* Copyright (c) 2020-2022. Mateusz Szymański Teamwant
* https://teamwant.pl
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
* @author Teamwant <kontakt@teamwant.pl>
* @copyright Copyright 2020-2023 © Teamwant Mateusz Szymański All right reserved
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* @category Teamwant
* @package Teamwant
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,52 @@
<?php
/**
* Redis Cache
* Version: 2.1.1
* Copyright (c) 2020-2022. Mateusz Szymański Teamwant
* https://teamwant.pl
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
* @author Teamwant <kontakt@teamwant.pl>
* @copyright Copyright 2020-2023 © Teamwant Mateusz Szymański All right reserved
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* @category Teamwant
* @package Teamwant
*/
class Order extends OrderCore
{
/**
* Get the order id by its cart id.
*
* @param int $id_cart Cart id
*
* @return int $id_order
*/
public static function getIdByCartId($id_cart)
{
if (_PS_CACHE_ENABLED_) {
$caching_system = _PS_CACHING_SYSTEM_;
if (
$caching_system === 'Redis'
&& class_exists(\Teamwant_Redis::class)
) {
$sql = 'SELECT `id_order`
FROM `' . _DB_PREFIX_ . 'orders`
WHERE `id_cart` = ' . (int)$id_cart .
Shop::addSqlRestriction();
$result = Db::getInstance()->getValue($sql, false);
return !empty($result) ? (int)$result : false;
}
}
return parent::getIdByCartId($id_cart);
}
}

View File

@@ -0,0 +1,30 @@
<?php
/**
* Redis Cache
* Version: 2.1.1
* Copyright (c) 2020-2022. Mateusz Szymański Teamwant
* https://teamwant.pl
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
* @author Teamwant <kontakt@teamwant.pl>
* @copyright Copyright 2020-2023 © Teamwant Mateusz Szymański All right reserved
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* @category Teamwant
* @package Teamwant
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;

View File

@@ -0,0 +1,231 @@
<?php
/**
* Redis Cache
* Version: 2.1.1
* Copyright (c) 2020-2022. Mateusz Szymański Teamwant
* https://teamwant.pl
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
* @author Teamwant <kontakt@teamwant.pl>
* @copyright Copyright 2020-2023 © Teamwant Mateusz Szymański All right reserved
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* @category Teamwant
* @package Teamwant
*/
class StockAvailable extends StockAvailableCore
{
public $enable_redis = false;
public $use_cache_for_stock_manager = true;
/**
* @param null $id
* @param null $id_lang
* @param null $id_shop
* @param null $translator
*
* @throws PrestaShopDatabaseException
* @throws PrestaShopException
*/
public function __construct($id = null, $id_lang = null, $id_shop = null, $translator = null) {
parent::__construct($id, $id_lang, $id_shop, $translator);
if (_PS_CACHE_ENABLED_) {
$caching_system = _PS_CACHING_SYSTEM_;
if (
$caching_system === 'Redis'
&& class_exists(\Teamwant_Redis::class)
) {
$this->enable_redis = true;
$this->use_cache_for_stock_manager = \Teamwant_Redis::getCacheConfiguration()['use_cache_for_stock_manager'];
}
}
}
/**
* NULL gdy mamy wykonac standardową akcje, bool gdy mamy nadpisać wartość
*
* @return null|boolean
*/
private static function getUseCacheForStockManager() {
if (_PS_CACHE_ENABLED_) {
$caching_system = _PS_CACHING_SYSTEM_;
if (
$caching_system === 'Redis'
&& class_exists(\Teamwant_Redis::class)
) {
return (bool) \Teamwant_Redis::getCacheConfiguration()['use_cache_for_stock_manager'];
}
}
return null;
}
public static function getStockAvailableIdByProductId($id_product, $id_product_attribute = null, $id_shop = null)
{
if (!Validate::isUnsignedId($id_product)) {
return false;
}
$query = new DbQuery();
$query->select('id_stock_available');
$query->from('stock_available');
$query->where('id_product = ' . (int) $id_product);
if ($id_product_attribute !== null) {
$query->where('id_product_attribute = ' . (int) $id_product_attribute);
}
$query = StockAvailable::addSqlShopRestriction($query, $id_shop);
if (($isEnabled = self::getUseCacheForStockManager()) !== null) {
return (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query, $isEnabled);
}
return (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
}
/**
* For a given product, tells if it depends on the physical (usable) stock.
*
* @param int $id_product
* @param int $id_shop Optional : gets context if null @see Context::getContext()
*
* @return bool : depends on stock @see $depends_on_stock
*/
public static function dependsOnStock($id_product, $id_shop = null)
{
if (!Validate::isUnsignedId($id_product)) {
return false;
}
$query = new DbQuery();
$query->select('depends_on_stock');
$query->from('stock_available');
$query->where('id_product = ' . (int) $id_product);
$query->where('id_product_attribute = 0');
$query = StockAvailable::addSqlShopRestriction($query, $id_shop);
if (($isEnabled = self::getUseCacheForStockManager()) !== null) {
return (bool) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query, $isEnabled);
}
return (bool) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
}
/**
* For a given product, get its "out of stock" flag.
*
* @param int $id_product
* @param int $id_shop Optional : gets context if null @see Context::getContext()
*
* @return bool : depends on stock @see $depends_on_stock
*/
public static function outOfStock($id_product, $id_shop = null)
{
if (!Validate::isUnsignedId($id_product)) {
return false;
}
$query = new DbQuery();
$query->select('out_of_stock');
$query->from('stock_available');
$query->where('id_product = ' . (int) $id_product);
$query->where('id_product_attribute = 0');
$query = StockAvailable::addSqlShopRestriction($query, $id_shop);
if (($isEnabled = self::getUseCacheForStockManager()) !== null) {
return (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query, $isEnabled);
}
return (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
}
/**
* @param int $id_product
* @param int id_product_attribute Optional
* @param int $id_shop Optional
*
* @return bool|string
*/
public static function getLocation($id_product, $id_product_attribute = null, $id_shop = null)
{
$id_product = (int) $id_product;
if (null === $id_product_attribute) {
$id_product_attribute = 0;
} else {
$id_product_attribute = (int) $id_product_attribute;
}
$query = new DbQuery();
$query->select('location');
$query->from('stock_available');
$query->where('id_product = ' . $id_product);
$query->where('id_product_attribute = ' . $id_product_attribute);
$query = StockAvailable::addSqlShopRestriction($query, $id_shop);
if (($isEnabled = self::getUseCacheForStockManager()) !== null) {
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query, $isEnabled);
}
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
}
/**
* For a given id_product and id_product_attribute, gets its stock available.
*
* @param int $id_product
* @param int $id_product_attribute Optional
* @param int $id_shop Optional : gets context by default
*
* @return int Quantity
*/
public static function getQuantityAvailableByProduct($id_product = null, $id_product_attribute = null, $id_shop = null)
{
$isEnableCache = true;
// if null, it's a product without attributes
if ($id_product_attribute === null) {
$id_product_attribute = 0;
}
$key = 'StockAvailable::getQuantityAvailableByProduct_' . (int) $id_product . '-' . (int) $id_product_attribute . '-' . (int) $id_shop;
if (($isEnabled = self::getUseCacheForStockManager()) !== null) {
$isEnableCache = $isEnabled;
}
if (!Cache::isStored($key) || !$isEnableCache) {
$query = new DbQuery();
$query->select('SUM(quantity)');
$query->from('stock_available');
// if null, it's a product without attributes
if ($id_product !== null) {
$query->where('id_product = ' . (int) $id_product);
}
$query->where('id_product_attribute = ' . (int) $id_product_attribute);
$query = StockAvailable::addSqlShopRestriction($query, $id_shop);
$result = (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query, $isEnableCache);
if ($isEnableCache) {
Cache::store($key, $result);
}
return $result;
}
return Cache::retrieve($key);
}
}

View File

@@ -0,0 +1,30 @@
<?php
/**
* Redis Cache
* Version: 2.1.1
* Copyright (c) 2020-2022. Mateusz Szymański Teamwant
* https://teamwant.pl
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
* @author Teamwant <kontakt@teamwant.pl>
* @copyright Copyright 2020-2023 © Teamwant Mateusz Szymański All right reserved
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* @category Teamwant
* @package Teamwant
*/
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Location: ../");
exit;