1 | <?php |
||
23 | class MongoDB extends AbstractCache implements CacheInterface |
||
24 | { |
||
25 | /** |
||
26 | * The database name. |
||
27 | * |
||
28 | * @var string |
||
29 | */ |
||
30 | const DATABASE = 'geotools'; |
||
31 | |||
32 | /** |
||
33 | * The collection name. |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | const COLLECTION = 'geotools_cache'; |
||
38 | |||
39 | |||
40 | /** |
||
41 | * The collection to work with. |
||
42 | * |
||
43 | * @var MongoCollection |
||
44 | */ |
||
45 | protected $collection; |
||
46 | |||
47 | |||
48 | /** |
||
49 | * Constructor. |
||
50 | * |
||
51 | * @param string $server The server information (optional). |
||
52 | * @param string $database The database name (optional). |
||
53 | * @param string $collection The collection name (optional). |
||
54 | * |
||
55 | * @throws InvalidArgumentException |
||
56 | */ |
||
57 | public function __construct($server = null, $database = self::DATABASE, $collection = self::COLLECTION) |
||
66 | |||
67 | /** |
||
68 | * {@inheritDoc} |
||
69 | */ |
||
70 | public function getKey($providerName, $query) |
||
74 | |||
75 | /** |
||
76 | * {@inheritDoc} |
||
77 | */ |
||
78 | public function cache(BatchGeocoded $geocoded) |
||
91 | |||
92 | /** |
||
93 | * {@inheritDoc} |
||
94 | */ |
||
95 | public function isCached($providerName, $query) |
||
110 | |||
111 | /** |
||
112 | * {@inheritDoc} |
||
113 | */ |
||
114 | public function flush() |
||
118 | } |
||
119 |