|
| 1 | +<?php |
| 2 | + /*************************************************************************** |
| 3 | + * Copyright (C) 2011 by Alexander A. Klestov * |
| 4 | + * * |
| 5 | + * This program is free software; you can redistribute it and/or modify * |
| 6 | + * it under the terms of the GNU Lesser General Public License as * |
| 7 | + * published by the Free Software Foundation; either version 3 of the * |
| 8 | + * License, or (at your option) any later version. * |
| 9 | + * * |
| 10 | + ***************************************************************************/ |
| 11 | + |
| 12 | + /** |
| 13 | + * Cache with read-only access. |
| 14 | + * |
| 15 | + * @ingroup Cache |
| 16 | + **/ |
| 17 | + final class ReadOnlyPeer extends CachePeer |
| 18 | + { |
| 19 | + /** |
| 20 | + * @var CachePeer |
| 21 | + */ |
| 22 | + private $innerPeer = null; |
| 23 | + |
| 24 | + /** |
| 25 | + * @return ReadOnlyPeer |
| 26 | + */ |
| 27 | + public static function create(CachePeer $peer) |
| 28 | + { |
| 29 | + return new ReadOnlyPeer($peer); |
| 30 | + } |
| 31 | + |
| 32 | + public function __construct(CachePeer $peer) |
| 33 | + { |
| 34 | + $this->innerPeer = $peer; |
| 35 | + } |
| 36 | + |
| 37 | + public function isAlive() |
| 38 | + { |
| 39 | + return $this->innerPeer->isAlive(); |
| 40 | + } |
| 41 | + |
| 42 | + public function mark($className) |
| 43 | + { |
| 44 | + return $this->innerPeer->mark($className); |
| 45 | + } |
| 46 | + |
| 47 | + public function get($key) |
| 48 | + { |
| 49 | + return $this->innerPeer->get($key); |
| 50 | + } |
| 51 | + |
| 52 | + public function getList($indexes) |
| 53 | + { |
| 54 | + return $this->innerPeer->getList($indexes); |
| 55 | + } |
| 56 | + |
| 57 | + public function clean() |
| 58 | + { |
| 59 | + throw new UnsupportedMethodException(); |
| 60 | + } |
| 61 | + |
| 62 | + public function increment($key, $value) |
| 63 | + { |
| 64 | + throw new UnsupportedMethodException(); |
| 65 | + } |
| 66 | + |
| 67 | + public function decrement($key, $value) |
| 68 | + { |
| 69 | + throw new UnsupportedMethodException(); |
| 70 | + } |
| 71 | + |
| 72 | + public function delete($index, $time = null) |
| 73 | + { |
| 74 | + throw new UnsupportedMethodException(); |
| 75 | + } |
| 76 | + |
| 77 | + public function append($key, $data) |
| 78 | + { |
| 79 | + throw new UnsupportedMethodException(); |
| 80 | + } |
| 81 | + |
| 82 | + protected function store( |
| 83 | + $method, $index, $value, $expires = Cache::EXPIRES_MINIMUM |
| 84 | + ) |
| 85 | + { |
| 86 | + throw new UnsupportedMethodException(); |
| 87 | + } |
| 88 | + } |
| 89 | +?> |
0 commit comments