承接 momentohq/drupal-cache 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

momentohq/drupal-cache

最新稳定版本:v0.5.5

Composer 安装命令:

composer require momentohq/drupal-cache

包简介

README 文档

README

Prerequisites

A Momento API Token is required. You can generate one using the Momento Console.

The Momento Cache module uses Momento's PHP SDK internally. While installing the Drupal module will automatically install the SDK for you. Separately, you will need to install and enable the following extensions:

  1. The PHP gRPC extension for the SDK to function.
  2. The C Protobuf extension for PHP.

A Momento cache is required to handle Drupal's caching requests. You can create a cache in the Momento Console.

Drupal and Momento Rate Limiting

Momento's free tier limits accounts' transactions per second (TPS) and throughput (KiBps), and requests that exceed those limits are throttled. While the default limits are fine for exploring and developing with the Momento integration, Drupal's usage of the cache backend can be significantly higher than the default throttling limits under load. Prior to using the integration in a high-traffic or production environment, please reach out to support@momentohq.com to raise your account limits. You can check the Drupal dblog and/or the logfile you configure in the settings (instructions below) for rate limiting error messages.

Installation and Configuration

Add the module with composer require 'momentohq/drupal-cache:0.5.2'.

Enable the momento_cache module in your Drupal administrator interface or using drush en momento_cache.

Add the following to your settings.php file:

$settings['cache']['default'] = 'cache.backend.momento_cache';
$settings['momento_cache']['api_token'] = '<YOUR_MOMENTO_TOKEN>';
$settings['momento_cache']['cache_name'] = '<YOUR_CACHE_NAME>';
$settings['momento_cache']['logfile'] = '<YOUR_LOG_FILE_PATH>';

Replace <YOUR_MOMENTO_TOKEN> with the token you generated in the console. You may also use an environment variable named MOMENTO_API_TOKEN to pass your API token to the Momento cache backend. If both are supplied, the settings file takes precedence.

Replace <YOUR_CACHE_NAME> with the name of your existing Momento cache. You may also use an environment variable named MOMENTO_CACHE_NAME to pass this value. If both are supplied, the settings file takes precedence. You must create the cache before using the module. If the cache doesn't exist, errors are written to the Drupal dblog as well as the logfile configured in your settings, if you have specified one.

Replace <YOUR_LOG_FILE_PATH> with the path of a file writable by your Drupal server or with null if you want to suppress logging. This logfile is used for logging and timing requests as they are handled by the module. Please be aware that this file will grow quickly over time, so if you choose to enable it long-term, you should probably use logrotate or some similar utility to keep it from growing out of control.

The example above uses Momento for all Drupal caches. If you prefer to use Momento for specific cache bins, you may assign them individually as well: $settings['cache']['bins']['render'] = 'cache.backend.momento_cache'

统计信息

  • 总下载量: 266
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2023-09-27