MemcachedAdapter.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  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. namespace Symfony\Component\Cache\Adapter;
  11. use Symfony\Component\Cache\Traits\MemcachedTrait;
  12. class MemcachedAdapter extends AbstractAdapter
  13. {
  14. use MemcachedTrait;
  15. protected $maxIdLength = 250;
  16. /**
  17. * Using a MemcachedAdapter with a TagAwareAdapter for storing tags is discouraged.
  18. * Using a RedisAdapter is recommended instead. If you cannot do otherwise, be aware that:
  19. * - the Memcached::OPT_BINARY_PROTOCOL must be enabled
  20. * (that's the default when using MemcachedAdapter::createConnection());
  21. * - tags eviction by Memcached's LRU algorithm will break by-tags invalidation;
  22. * your Memcached memory should be large enough to never trigger LRU.
  23. *
  24. * Using a MemcachedAdapter as a pure items store is fine.
  25. */
  26. public function __construct(\Memcached $client, string $namespace = '', int $defaultLifetime = 0)
  27. {
  28. $this->init($client, $namespace, $defaultLifetime);
  29. }
  30. }