KeyPrefixProcessor.php 748 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /*
  3. * This file is part of the Predis package.
  4. *
  5. * (c) Daniele Alessandri <suppakilla@gmail.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 Predis\Commands\Processors;
  11. use Predis\Commands\ICommand;
  12. class KeyPrefixProcessor implements ICommandProcessor
  13. {
  14. private $_prefix;
  15. public function __construct($prefix)
  16. {
  17. $this->setPrefix($prefix);
  18. }
  19. public function setPrefix($prefix)
  20. {
  21. $this->_prefix = $prefix;
  22. }
  23. public function getPrefix()
  24. {
  25. return $this->_prefix;
  26. }
  27. public function process(ICommand $command)
  28. {
  29. $command->prefixKeys($this->_prefix);
  30. }
  31. }