S
S
Sergey2018-06-04 18:48:33
Yii
Sergey, 2018-06-04 18:48:33

Is it possible to store multidimensional arrays in yii2 cache?

The documentation has a multiSet method. He works:

$data = [
            'yep' => '1', 
            'hey' => '2'
];
 
$cache->multiSet($data);

But I would like to have a different structure and store something like
$data = [
    'pages' => [
        'index' =>
            [
                '1' => 'hey',
            ]
    ]
];

on the redis server.
Is it possible to implement this using framework methods?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2018-06-04
@butteff

Multidimensional arrays can be stored and not only using multiSet. MultiSet is aware of several items at once. In each of them, there can be a multidimensional array.
What stopped you from checking? Is it 2 lines of code?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question