36 lines
843 B
PHP
36 lines
843 B
PHP
|
<?php
|
||
|
|
||
|
namespace Application\Controller;
|
||
|
|
||
|
use FuzeWorks\Factory;
|
||
|
use FuzeWorks\ObjectStorage\ObjectStorageComponent;
|
||
|
use FuzeWorks\WebController;
|
||
|
|
||
|
class CacheController extends WebController
|
||
|
{
|
||
|
|
||
|
public function getCacheItems(int $index = 1, int $pageSize = 50): ?array
|
||
|
{
|
||
|
// Get storage
|
||
|
/** @var ObjectStorageComponent $storage */
|
||
|
$storage = Factory::getInstance("storage");
|
||
|
$store = $storage->getStorage();
|
||
|
|
||
|
// First retrieve the index
|
||
|
$objectIndex = $store->getIndex();
|
||
|
|
||
|
$out = [];
|
||
|
for ($i = $index; $i < ($index + $pageSize); $i++)
|
||
|
{
|
||
|
if (!isset($objectIndex[$i]))
|
||
|
continue;
|
||
|
|
||
|
|
||
|
$out[] = $store->getItem($objectIndex[$i]);
|
||
|
//$out[] = $store->getItemMeta($objectIndex[$i]);
|
||
|
}
|
||
|
|
||
|
return $out;
|
||
|
}
|
||
|
|
||
|
}
|