@@ -39,9 +39,11 @@ as the second and third parameters::
39
39
// own lifetime, with a value 0 causing items to be stored indefinitely (i.e.
40
40
// until RedisAdapter::clear() is invoked or the server(s) are purged)
41
41
$defaultLifetime = 0,
42
- // $marshaller (optional) MarshallerInterface instance to control serialization
43
- // and deserialization of cache items. By default, it uses native PHP serialization.
44
- // Useful to compress data, use custom serialization, or optimize the size and performance of cached items.
42
+
43
+ // $marshaller (optional) An instance of MarshallerInterface to control the serialization
44
+ // and deserialization of cache items. By default, native PHP serialization is used.
45
+ // This can be useful for compressing data, applying custom serialization logic, or
46
+ // optimizing the size and performance of cached items
45
47
?MarshallerInterface $marshaller = null
46
48
);
47
49
@@ -275,6 +277,7 @@ Working with Marshaller
275
277
276
278
TagAwareMarshaller for Tag-Based Caching
277
279
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
280
+
278
281
Optimizes caching for tag-based retrieval, allowing efficient management of related items::
279
282
280
283
$marshaller = new TagAwareMarshaller();
@@ -287,7 +290,8 @@ Optimizes caching for tag-based retrieval, allowing efficient management of rela
287
290
288
291
SodiumMarshaller for Encrypted Caching
289
292
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
290
- Encrypts cached data with Sodium for added security::
293
+
294
+ Encrypts cached data using Sodium for enhanced security::
291
295
292
296
$encryptionKeys = [sodium_crypto_box_keypair()];
293
297
$marshaller = new SodiumMarshaller($encryptionKeys);
@@ -300,7 +304,8 @@ Encrypts cached data with Sodium for added security::
300
304
301
305
DefaultMarshaller with igbinary Serialization
302
306
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
303
- Uses igbinary for faster, more efficient serialization when available::
307
+
308
+ Uses ``igbinary` for faster and more efficient serialization when available ::
304
309
305
310
$marshaller = new DefaultMarshaller(true);
306
311
@@ -312,7 +317,8 @@ Uses igbinary for faster, more efficient serialization when available::
312
317
313
318
DefaultMarshaller with Exception on Failure
314
319
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
315
- Throws an exception if serialization fails, aiding in error handling::
320
+
321
+ Throws an exception if serialization fails, facilitating error handling::
316
322
317
323
$marshaller = new DefaultMarshaller(false, true);
318
324
@@ -323,12 +329,13 @@ Throws an exception if serialization fails, aiding in error handling::
323
329
$item->set('data');
324
330
$cache->save($item);
325
331
} catch (\ValueError $e) {
326
- echo 'Serialization failed: ' . $e->getMessage();
332
+ echo 'Serialization failed: '. $e->getMessage();
327
333
}
328
334
329
335
SodiumMarshaller with Key Rotation
330
336
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
331
- Supports key rotation, allowing secure decryption with both old and new keys::
337
+
338
+ Supports key rotation, ensuring secure decryption with both old and new keys::
332
339
333
340
$keys = [sodium_crypto_box_keypair(), sodium_crypto_box_keypair()];
334
341
$marshaller = new SodiumMarshaller($keys);
0 commit comments