| 
<?php
/**
 *   __ _  ___  ___ ___   ___   ___     ____ _ __ ___   ___
 *  / _` |/  / / __/ _ \ / _ \ /  /    / __/| '_ ` _ \ /  /
 * | (_| |\  \| (_| (_) | (_) |\  \   | (__ | | | | | |\  \
 *  \__,_|/__/ \___\___/ \___/ /__/    \___\|_| |_| |_|/__/
 *
 *
 ************************************************************************************
 * @ASCOOS-NAME            : ASCOOS CMS 25'                                            *
 * @ASCOOS-VERSION         : 25.0.0                                                    *
 * @ASCOOS-CATEGORY        : Framework (Frontend and Administrator Side)               *
 * @ASCOOS-CREATOR         : Drogidis Christos                                         *
 * @ASCOOS-SITE            : www.ascoos.com                                            *
 * @ASCOOS-LICENSE         : [Commercial] http://docs.ascoos.com/lics/ascoos/AGL.html  *
 * @ASCOOS-COPYRIGHT       : Copyright (c) 2007 - 2025, AlexSoft Software.             *
 ************************************************************************************
 *
 * @package                : ASCOOS FRAMEWORK Examples
 * @subpackage             : Handles Opcache-based Cache.
 * @source                 : afw-examples/classes/TCacheHandler/TCacheOpcacheHandler.php
 * @fileNo                 :
 * @version                : 25.0.0
 * @build               : 10829
 * @created                : 2024-07-01 20:00:00 UTC+2
 * @updated                : 2025-01-01 07:00:00 UTC+2
 * @author                 : Drogidis Christos
 * @authorSite             : www.alexsoft.gr
 * @license             : AGL-F
 *
 * @since PHP 8.2.0
 */
 declare(strict_types=1);
 
 require_once "../../autoload.php";
 
 use ASCOOS\FRAMEWORK\Kernel\Cache\Opcache\TCacheOpcacheHandler;
 
 
 /*
 <English> Create a TCacheOpcacheHandler object
 <Greek>  ?????????? ???????????? TCacheOpcacheHandler
 */
 $objOpcache = new TCacheOpcacheHandler(3600);
 
 /*
 <English> Get Opcache Stats
 <Greek>  ???? ??????????? Opcache
 */
 $stats = $objOpcache->getStats();
 print_r($stats);
 
 /*
 <English> Clear Opcache
 <Greek>  ?????????? Opcache
 */
 $objOpcache->clearCache();
 
 /*
 <English> Verify if Opcache Supports Key-Value Cache (Expected to fail)
 <Greek>  ?????????? ?? ?? Opcache ??????????? Key-Value Cache (?????????? ?? ????????)
 */
 try {
 $objOpcache->saveCache('example_key', ['data' => 'sample data']);
 } catch (Exception $e) {
 echo $e->getMessage() . "\n";
 }
 
 /*
 <English> Verify if Opcache Supports Key-Value Cache Lookup (Expected to return false)
 <Greek>  ?????????? ?? ?? Opcache ??????????? Key-Value Cache Lookup (?????????? ?? ?????????? false)
 */
 $cachedData = $objOpcache->checkCache('example_key');
 echo $cachedData ? 'Cache hit' : 'Cache miss';
 
 ?>
 
 |