1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
Oinktube/plugin/Cache/Objects/CacheDB.php
Daniel Neto b930abff26 Update
2023-11-10 14:30:26 -03:00

75 lines
2.3 KiB
PHP

<?php
require_once $global['systemRootPath'] . 'plugin/Cache/Objects/CachesInDB.php';
require_once $global['systemRootPath'] . 'plugin/Cache/Objects/CachesInDBMem.php';
class CacheDB
{
public static $loggedType_NOT_LOGGED = 'n';
public static $loggedType_LOGGED = 'l';
public static $loggedType_ADMIN = 'a';
public static $prefix = 'ypt_cache_';
static $CACHE_ON_DISK = 'disk';
static $CACHE_ON_MEMORY = 'mem';
private static $cacheType = 'disk';
public static function encodeContent($content)
{
return CachesInDB::encodeContent($content);
}
public static function deleteCacheStartingWith($name)
{
if(self::$cacheType == self::$CACHE_ON_MEMORY){
return CachesInDBMem::_deleteCacheStartingWith($name);
}else{
return CachesInDB::_deleteCacheStartingWith($name);
}
}
public static function deleteCacheWith($name)
{
if(self::$cacheType == self::$CACHE_ON_MEMORY){
return CachesInDBMem::_deleteCacheWith($name);
}else{
return CachesInDB::_deleteCacheWith($name);
}
}
public static function deleteAllCache()
{
if(self::$cacheType == self::$CACHE_ON_MEMORY){
return CachesInDBMem::_deleteAllCache();
}else{
return CachesInDB::_deleteAllCache();
}
}
public static function deleteCache($name)
{
if(self::$cacheType == self::$CACHE_ON_MEMORY){
return CachesInDBMem::_deleteCache($name);
}else{
return CachesInDB::_deleteCache($name);
}
}
public static function getCache($name, $domain, $ishttps, $user_location, $loggedType, $ignoreMetadata = false)
{
if(self::$cacheType == self::$CACHE_ON_MEMORY){
return CachesInDBMem::_getCache($name, $domain, $ishttps, $user_location, $loggedType, $ignoreMetadata);
}else{
return CachesInDB::_getCache($name, $domain, $ishttps, $user_location, $loggedType, $ignoreMetadata);
}
}
public static function setBulkCache($cacheArray, $metadata)
{
if(self::$cacheType == self::$CACHE_ON_MEMORY){
return CachesInDBMem::setBulkCache($cacheArray, $metadata);
}else{
return CachesInDB::setBulkCache($cacheArray, $metadata);
}
}
}