apcu.php 623 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /**
  3. * Copyright (c) 2012 Bart Visscher <bartv@thisnet.nl>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. namespace OC\Memcache;
  9. class APCu extends APC {
  10. public function clear($prefix = '') {
  11. $ns = $this->getNamespace() . $prefix;
  12. $ns = preg_quote($ns, '/');
  13. $iter = new \APCIterator('/^'.$ns.'/');
  14. return apc_delete($iter);
  15. }
  16. static public function isAvailable() {
  17. if (!extension_loaded('apcu')) {
  18. return false;
  19. } elseif (!ini_get('apc.enable_cli') && \OC::$CLI) {
  20. return false;
  21. } else {
  22. return true;
  23. }
  24. }
  25. }