diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..a94e90c3f542e17591ddd0f2e86ba3666b55b0f3 --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# serialization_cache Module + +[Project Page](http://drupal.org/project/serialization_cache) + +## Contents + +1. [About](#about) +2. [Installation](#installation) +3. [Credits](#credits) + +## About + +The Drupal 8 serialization system is quite flexible but can be time-consuming when processing all entities recursively, including their fields and embedded entities. This module provides caching for normalized entities and embedded entities by using different caches for different accesses, such as checking "view" permissions for an entity and its fields. + +## Installation + +1. **Install the module**: Follow the standard installation instructions for Drupal modules. For detailed steps, refer to [Drupal Installation Guide](https://www.drupal.org/node/1897420). + +2. **Override the serializer service**: The module overrides the default `serializer` service with `AccessCachingSerializer`. This is done automatically by the module. Alternatively, you can achieve this in your own module by implementing the `ServiceModifierInterface`. Here's an example: + + ```php + use Drupal\Core\DependencyInjection\ContainerBuilder; + use Drupal\Core\DependencyInjection\ServiceModifierInterface; + use Drupal\serialization_cache\AccessCachingSerializer; + + class YourModuleServiceProvider implements ServiceModifierInterface { + public function alter(ContainerBuilder $container) { + if ($container->hasDefinition('serializer')) { + $container->getDefinition('serializer')->setClass(AccessCachingSerializer::class); + } + } + } + ``` + +## Credits + +For more information, visit the [project page](http://drupal.org/project/serialization_cache). diff --git a/README.txt b/README.txt deleted file mode 100644 index 7d40a06dc64913da0424320561aa9f9d33a35095..0000000000000000000000000000000000000000 --- a/README.txt +++ /dev/null @@ -1,43 +0,0 @@ --------------------------------------------------------------------------------- - serialization_cache module Readme - http://drupal.org/project/serialization_cache --------------------------------------------------------------------------------- - -Contents: -========= -1. ABOUT -2. INSTALLATION -3. CREDITS - -1. ABOUT -======== - -Drupal 8 serialization system is pretty flexible but it causes serious time cost -to recursively process all entities, their fields, embed entities if they are -exist and etc. -This module provides caching for normalized entities (+embedded entities) -using different caches for different accesses (checking "view" for entity and -its fields). - -2. INSTALLATION -=============== - -First step: install as usual, see https://www.drupal.org/node/1897420 for -further information. - -Second step: you need to override your current "serializer" service with the -AccessCachingSerializer. This module already does it. -Alternatively you can do it like so in your own module: - -class YourModuleServiceProvider implements ServiceModifierInterface { - public function alter(ContainerBuilder $container) { - if ($container->hasDefinition('serializer')) { - $container->getDefinition('serializer')->setClass(AccessCachingSerializer::class); - } - } -} - -4. CREDITS -========== - -Project page: http://drupal.org/project/serialization_cache