ver. 0.282: Banners frontend migration, Cache cleanup, Shared\Cache namespace

- Banners frontend: front\Views\Banners (new), BannerRepository +2 frontend methods,
  front\view\Site przepięty, usunięte front\factory\Banners i front\view\Banners
- Cache cleanup: eliminacja legacy class.Cache.php (file-based cache),
  13 metod front\factory przepiętych z \Cache::fetch/store na CacheHandler
- Shared\Cache namespace: CacheHandler i RedisConnection przeniesione do Shared\Cache\,
  60 odwołań CacheHandler i 12 odwołań RedisConnection przepiętych,
  usunięte backward-compat wrappery class.CacheHandler.php i class.RedisConnection.php
- Naprawione rozbieżności kluczy cache (random_products, category_name)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-16 21:25:50 +01:00
parent fb81c54e06
commit 285cbe5515
54 changed files with 594 additions and 346 deletions

View File

@@ -17,15 +17,16 @@ class ShopPaymentMethod
public static function payment_methods_by_transport( $transport_method_id )
{
$transport_method_id = (int)$transport_method_id;
$cacheHandler = new \Shared\Cache\CacheHandler();
$cacheKey = 'payment_methods_by_transport' . $transport_method_id;
$payments = \Cache::fetch( $cacheKey );
$objectData = $cacheHandler->get( $cacheKey );
if ( $payments !== false && is_array( $payments ) ) {
return $payments;
if ( $objectData ) {
return unserialize( $objectData );
}
$payments = self::repo()->forTransport( $transport_method_id );
\Cache::store( $cacheKey, $payments );
$cacheHandler->set( $cacheKey, $payments );
return $payments;
}
@@ -38,12 +39,18 @@ class ShopPaymentMethod
public static function payment_method( $payment_method_id )
{
$payment_method_id = (int)$payment_method_id;
$cacheHandler = new \Shared\Cache\CacheHandler();
$cacheKey = 'payment_method' . $payment_method_id;
$payment_method = \Cache::fetch( $cacheKey );
$objectData = $cacheHandler->get( $cacheKey );
if ( $payment_method === false ) {
if ( !$objectData )
{
$payment_method = self::repo()->findActiveById( $payment_method_id );
\Cache::store( $cacheKey, $payment_method );
$cacheHandler->set( $cacheKey, $payment_method );
}
else
{
return unserialize( $objectData );
}
return $payment_method;
@@ -51,15 +58,16 @@ class ShopPaymentMethod
public static function payment_methods()
{
$cacheHandler = new \Shared\Cache\CacheHandler();
$cacheKey = 'payment_methods';
$payment_methods = \Cache::fetch( $cacheKey );
$objectData = $cacheHandler->get( $cacheKey );
if ( $payment_methods !== false && is_array( $payment_methods ) ) {
return $payment_methods;
if ( $objectData ) {
return unserialize( $objectData );
}
$payment_methods = self::repo()->allActive();
\Cache::store( $cacheKey, $payment_methods );
$cacheHandler->set( $cacheKey, $payment_methods );
return $payment_methods;
}