ci4

Форк
0
/
Cache.php 
171 строка · 6.1 Кб
1
<?php
2

3
namespace Config;
4

5
use CodeIgniter\Cache\CacheInterface;
6
use CodeIgniter\Cache\Handlers\DummyHandler;
7
use CodeIgniter\Cache\Handlers\FileHandler;
8
use CodeIgniter\Cache\Handlers\MemcachedHandler;
9
use CodeIgniter\Cache\Handlers\PredisHandler;
10
use CodeIgniter\Cache\Handlers\RedisHandler;
11
use CodeIgniter\Cache\Handlers\WincacheHandler;
12
use CodeIgniter\Config\BaseConfig;
13

14
class Cache extends BaseConfig
15
{
16
    /**
17
     * --------------------------------------------------------------------------
18
     * Primary Handler
19
     * --------------------------------------------------------------------------
20
     *
21
     * The name of the preferred handler that should be used. If for some reason
22
     * it is not available, the $backupHandler will be used in its place.
23
     */
24
    public string $handler = 'file';
25

26
    /**
27
     * --------------------------------------------------------------------------
28
     * Backup Handler
29
     * --------------------------------------------------------------------------
30
     *
31
     * The name of the handler that will be used in case the first one is
32
     * unreachable. Often, 'file' is used here since the filesystem is
33
     * always available, though that's not always practical for the app.
34
     */
35
    public string $backupHandler = 'dummy';
36

37
    /**
38
     * --------------------------------------------------------------------------
39
     * Cache Directory Path
40
     * --------------------------------------------------------------------------
41
     *
42
     * The path to where cache files should be stored, if using a file-based
43
     * system.
44
     *
45
     * @deprecated Use the driver-specific variant under $file
46
     */
47
    public string $storePath = WRITEPATH . 'cache/';
48

49
    /**
50
     * --------------------------------------------------------------------------
51
     * Key Prefix
52
     * --------------------------------------------------------------------------
53
     *
54
     * This string is added to all cache item names to help avoid collisions
55
     * if you run multiple applications with the same cache engine.
56
     */
57
    public string $prefix = '';
58

59
    /**
60
     * --------------------------------------------------------------------------
61
     * Default TTL
62
     * --------------------------------------------------------------------------
63
     *
64
     * The default number of seconds to save items when none is specified.
65
     *
66
     * WARNING: This is not used by framework handlers where 60 seconds is
67
     * hard-coded, but may be useful to projects and modules. This will replace
68
     * the hard-coded value in a future release.
69
     */
70
    public int $ttl = 60;
71

72
    /**
73
     * --------------------------------------------------------------------------
74
     * Reserved Characters
75
     * --------------------------------------------------------------------------
76
     *
77
     * A string of reserved characters that will not be allowed in keys or tags.
78
     * Strings that violate this restriction will cause handlers to throw.
79
     * Default: {}()/\@:
80
     *
81
     * NOTE: The default set is required for PSR-6 compliance.
82
     */
83
    public string $reservedCharacters = '{}()/\@:';
84

85
    /**
86
     * --------------------------------------------------------------------------
87
     * File settings
88
     * --------------------------------------------------------------------------
89
     * Your file storage preferences can be specified below, if you are using
90
     * the File driver.
91
     *
92
     * @var array<string, int|string|null>
93
     */
94
    public array $file = [
95
        'storePath' => WRITEPATH . 'cache/',
96
        'mode'      => 0640,
97
    ];
98

99
    /**
100
     * -------------------------------------------------------------------------
101
     * Memcached settings
102
     * -------------------------------------------------------------------------
103
     * Your Memcached servers can be specified below, if you are using
104
     * the Memcached drivers.
105
     *
106
     * @see https://codeigniter.com/user_guide/libraries/caching.html#memcached
107
     *
108
     * @var array<string, bool|int|string>
109
     */
110
    public array $memcached = [
111
        'host'   => '127.0.0.1',
112
        'port'   => 11211,
113
        'weight' => 1,
114
        'raw'    => false,
115
    ];
116

117
    /**
118
     * -------------------------------------------------------------------------
119
     * Redis settings
120
     * -------------------------------------------------------------------------
121
     * Your Redis server can be specified below, if you are using
122
     * the Redis or Predis drivers.
123
     *
124
     * @var array<string, int|string|null>
125
     */
126
    public array $redis = [
127
        'host'     => '127.0.0.1',
128
        'password' => null,
129
        'port'     => 6379,
130
        'timeout'  => 0,
131
        'database' => 0,
132
    ];
133

134
    /**
135
     * --------------------------------------------------------------------------
136
     * Available Cache Handlers
137
     * --------------------------------------------------------------------------
138
     *
139
     * This is an array of cache engine alias' and class names. Only engines
140
     * that are listed here are allowed to be used.
141
     *
142
     * @var array<string, class-string<CacheInterface>>
143
     */
144
    public array $validHandlers = [
145
        'dummy'     => DummyHandler::class,
146
        'file'      => FileHandler::class,
147
        'memcached' => MemcachedHandler::class,
148
        'predis'    => PredisHandler::class,
149
        'redis'     => RedisHandler::class,
150
        'wincache'  => WincacheHandler::class,
151
    ];
152

153
    /**
154
     * --------------------------------------------------------------------------
155
     * Web Page Caching: Cache Include Query String
156
     * --------------------------------------------------------------------------
157
     *
158
     * Whether to take the URL query string into consideration when generating
159
     * output cache files. Valid options are:
160
     *
161
     *    false = Disabled
162
     *    true  = Enabled, take all query parameters into account.
163
     *            Please be aware that this may result in numerous cache
164
     *            files generated for the same page over and over again.
165
     *    ['q'] = Enabled, but only take into account the specified list
166
     *            of query parameters.
167
     *
168
     * @var bool|list<string>
169
     */
170
    public $cacheQueryString = false;
171
}
172

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.