Nextrek
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
<?php namespace Illuminate\Cache;
use Illuminate\Support\Manager;
class CacheManager extends Manager {
/**
* Create an instance of the APC cache driver.
*
* @return \Illuminate\Cache\ApcStore
*/
protected function createApcDriver()
{
return $this->repository(new ApcStore(new ApcWrapper, $this->getPrefix()));
}
/**
* Create an instance of the array cache driver.
*
* @return \Illuminate\Cache\ArrayStore
*/
protected function createArrayDriver()
{
return $this->repository(new ArrayStore);
}
/**
* Create an instance of the file cache driver.
*
* @return \Illuminate\Cache\FileStore
*/
protected function createFileDriver()
{
$path = $this->app['config']['cache.path'];
return $this->repository(new FileStore($this->app['files'], $path));
}
/**
* Create an instance of the Memcached cache driver.
*
* @return \Illuminate\Cache\MemcachedStore
*/
protected function createMemcachedDriver()
{
$servers = $this->app['config']['cache.memcached'];
$memcached = $this->app['memcached.connector']->connect($servers);
return $this->repository(new MemcachedStore($memcached, $this->getPrefix()));
}
/**
* Create an instance of the Null cache driver.
*
* @return \Illuminate\Cache\NullStore
*/
protected function createNullDriver()
{
return $this->repository(new NullStore);
}
/**
* Create an instance of the WinCache cache driver.
*
* @return \Illuminate\Cache\WinCacheStore
*/
protected function createWincacheDriver()
{
return $this->repository(new WinCacheStore($this->getPrefix()));
}
/**
* Create an instance of the XCache cache driver.
*
* @return \Illuminate\Cache\WinCacheStore
*/
protected function createXcacheDriver()
{
return $this->repository(new XCacheStore($this->getPrefix()));
}
/**
* Create an instance of the Redis cache driver.
*
* @return \Illuminate\Cache\RedisStore
*/
protected function createRedisDriver()
{
$redis = $this->app['redis'];
return $this->repository(new RedisStore($redis, $this->getPrefix()));
}
/**
* Create an instance of the database cache driver.
*
* @return \Illuminate\Cache\DatabaseStore
*/
protected function createDatabaseDriver()
{
$connection = $this->getDatabaseConnection();
$encrypter = $this->app['encrypter'];
// We allow the developer to specify which connection and table should be used
// to store the cached items. We also need to grab a prefix in case a table
// is being used by multiple applications although this is very unlikely.
$table = $this->app['config']['cache.table'];
$prefix = $this->getPrefix();
return $this->repository(new DatabaseStore($connection, $encrypter, $table, $prefix));
}
/**
* Get the database connection for the database driver.
*
* @return \Illuminate\Database\Connection
*/
protected function getDatabaseConnection()
{
$connection = $this->app['config']['cache.connection'];
return $this->app['db']->connection($connection);
}
/**
* Get the cache "prefix" value.
*
* @return string
*/
public function getPrefix()
{
return $this->app['config']['cache.prefix'];
}
/**
* Set the cache "prefix" value.
*
* @param string $name
* @return void
*/
public function setPrefix($name)
{
$this->app['config']['cache.prefix'] = $name;
}
/**
* Create a new cache repository with the given implementation.
*
* @param \Illuminate\Cache\StoreInterface $store
* @return \Illuminate\Cache\Repository
*/
protected function repository(StoreInterface $store)
{
return new Repository($store);
}
/**
* Get the default cache driver name.
*
* @return string
*/
public function getDefaultDriver()
{
return $this->app['config']['cache.driver'];
}
/**
* Set the default cache driver name.
*
* @param string $name
* @return void
*/
public function setDefaultDriver($name)
{
$this->app['config']['cache.driver'] = $name;
}
}
|
Revision |
Author |
Commited |
Message |
1464
|
MOliva
|
Tue 13 Oct, 2020 11:16:56 +0000 |
|