Cache.php 649 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace controllers;
  3. use controllers\utils\DbTrait;
  4. /**
  5. * Bench controller.
  6. */
  7. class Cache extends \Ubiquity\controllers\Controller {
  8. use DbTrait;
  9. protected $cache;
  10. public function __construct() {
  11. $this->cache = \Ubiquity\orm\DAO::getCache();
  12. }
  13. public function initialize() {
  14. \Ubiquity\utils\http\UResponse::setContentType('application/json');
  15. }
  16. public function index() {}
  17. public function cachedquery($queries = 1) {
  18. $worlds = [];
  19. $count = $this->getCount($queries);
  20. while ($count --) {
  21. $worlds[] = ($this->cache->fetch('models\\CachedWorld', \mt_rand(1, 10000)))->_rest;
  22. }
  23. echo \json_encode($worlds);
  24. }
  25. }