bootstrap.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. use Symfony\Polyfill\Apcu as p;
  11. if (!extension_loaded('apc') && !extension_loaded('apcu')) {
  12. return;
  13. }
  14. if (!function_exists('apcu_add')) {
  15. if (extension_loaded('Zend Data Cache')) {
  16. function apcu_add($key, $var = null, $ttl = 0) { return p\Apcu::apcu_add($key, $var, $ttl); }
  17. function apcu_delete($key) { return p\Apcu::apcu_delete($key); }
  18. function apcu_exists($keys) { return p\Apcu::apcu_exists($keys); }
  19. function apcu_fetch($key, &$success = null) { return p\Apcu::apcu_fetch($key, $success); }
  20. function apcu_store($key, $var = null, $ttl = 0) { return p\Apcu::apcu_store($key, $var, $ttl); }
  21. } else {
  22. function apcu_add($key, $var = null, $ttl = 0) { return apc_add($key, $var, $ttl); }
  23. function apcu_delete($key) { return apc_delete($key); }
  24. function apcu_exists($keys) { return apc_exists($keys); }
  25. function apcu_fetch($key, &$success = null) { return apc_fetch($key, $success); }
  26. function apcu_store($key, $var = null, $ttl = 0) { return apc_store($key, $var, $ttl); }
  27. }
  28. function apcu_cache_info($limited = false) { return apc_cache_info('user', $limited); }
  29. function apcu_cas($key, $old, $new) { return apc_cas($key, $old, $new); }
  30. function apcu_clear_cache() { return apc_clear_cache('user'); }
  31. function apcu_dec($key, $step = 1, &$success = false) { return apc_dec($key, $step, $success); }
  32. function apcu_inc($key, $step = 1, &$success = false) { return apc_inc($key, $step, $success); }
  33. function apcu_sma_info($limited = false) { return apc_sma_info($limited); }
  34. }
  35. if (!class_exists('APCUIterator', false) && class_exists('APCIterator', false)) {
  36. class APCUIterator extends APCIterator
  37. {
  38. public function __construct($search = null, $format = APC_ITER_ALL, $chunk_size = 100, $list = APC_LIST_ACTIVE)
  39. {
  40. parent::__construct('user', $search, $format, $chunk_size, $list);
  41. }
  42. }
  43. }