bootstrap80.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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('Zend Data Cache')) {
  12. if (!function_exists('apcu_add')) {
  13. function apcu_add($key, mixed $value, ?int $ttl = 0): array|bool { return p\Apcu::apcu_add($key, $value, (int) $ttl); }
  14. }
  15. if (!function_exists('apcu_delete')) {
  16. function apcu_delete($key): array|bool { return p\Apcu::apcu_delete($key); }
  17. }
  18. if (!function_exists('apcu_exists')) {
  19. function apcu_exists($key): array|bool { return p\Apcu::apcu_exists($key); }
  20. }
  21. if (!function_exists('apcu_fetch')) {
  22. function apcu_fetch($key, &$success = null): mixed { return p\Apcu::apcu_fetch($key, $success); }
  23. }
  24. if (!function_exists('apcu_store')) {
  25. function apcu_store($key, mixed $value, ?int $ttl = 0): array|bool { return p\Apcu::apcu_store($key, $value, (int) $ttl); }
  26. }
  27. } else {
  28. if (!function_exists('apcu_add')) {
  29. function apcu_add($key, mixed $value, ?int $ttl = 0): array|bool { return apc_add($key, $value, (int) $ttl); }
  30. }
  31. if (!function_exists('apcu_delete')) {
  32. function apcu_delete($key): array|bool { return apc_delete($key); }
  33. }
  34. if (!function_exists('apcu_exists')) {
  35. function apcu_exists($key): array|bool { return apc_exists($key); }
  36. }
  37. if (!function_exists('apcu_fetch')) {
  38. function apcu_fetch($key, &$success = null) { return apc_fetch($key, $success); }
  39. }
  40. if (!function_exists('apcu_store')) {
  41. function apcu_store($key, mixed $value, ?int $ttl = 0): array|bool { return apc_store($key, $value, (int) $ttl); }
  42. }
  43. }
  44. if (!function_exists('apcu_cache_info')) {
  45. function apcu_cache_info($limited = false) { return apc_cache_info('user', $limited); }
  46. }
  47. if (!function_exists('apcu_cas')) {
  48. function apcu_cas($key, $old, $new) { return apc_cas($key, $old, $new); }
  49. }
  50. if (!function_exists('apcu_clear_cache')) {
  51. function apcu_clear_cache() { return apc_clear_cache('user'); }
  52. }
  53. if (!function_exists('apcu_dec')) {
  54. function apcu_dec($key, $step = 1, &$success = false) { return apc_dec($key, $step, $success); }
  55. }
  56. if (!function_exists('apcu_inc')) {
  57. function apcu_inc($key, $step = 1, &$success = false) { return apc_inc($key, $step, $success); }
  58. }
  59. if (!function_exists('apcu_sma_info')) {
  60. function apcu_sma_info($limited = false) { return apc_sma_info($limited); }
  61. }
  62. if (!class_exists('APCuIterator', false) && class_exists('APCIterator', false)) {
  63. class APCuIterator extends APCIterator
  64. {
  65. public function __construct($search = null, $format = APC_ITER_ALL, $chunk_size = 100, $list = APC_LIST_ACTIVE)
  66. {
  67. parent::__construct('user', $search, $format, $chunk_size, $list);
  68. }
  69. }
  70. }