Entity cache 能提高性能, 把drupal 的entity 缓存起来, 但是不能跟memcache 和redis 一起用, 不然一删除一个node, 就会清空所有的缓存
Entity cache puts core entities into Drupal's cache API.
Due to the entity loading changes in Drupal 7, no core patches are required.
Don't bother using this module if you're not also going to usehttp://drupal.org/project/memcache or http://drupal.org/project/redis - the purpose of entitycache is to allow queries to be offloaded from the database onto alternative storage. There are minimal, if any, gains from using it with the default database cache.
代码如下
/** * Deletes multiple nodes. * * @param $nids * An array of node IDs. */ function node_delete_multiple($nids) { $transaction = db_transaction(); if (!empty($nids)) { $nodes = node_load_multiple($nids, array()); try { foreach ($nodes as $nid => $node) { // Call the node-specific callback (if any): node_invoke($node, 'delete'); module_invoke_all('node_delete', $node); module_invoke_all('entity_delete', $node, 'node'); field_attach_delete('node', $node); // Remove this node from the search index if needed. // This code is implemented in node module rather than in search module, // because node module is implementing search module's API, not the other // way around. if (module_exists('search')) { search_reindex($nid, 'node'); } } // Delete after calling hooks so that they can query node tables as needed. db_delete('node') ->condition('nid', $nids, 'IN') ->execute(); db_delete('node_revision') ->condition('nid', $nids, 'IN') ->execute(); db_delete('history') ->condition('nid', $nids, 'IN') ->execute(); db_delete('node_access') ->condition('nid', $nids, 'IN') ->execute(); } catch (Exception $e) { $transaction->rollback(); watchdog_exception('node', $e); throw $e; } // Clear the page and block and node_load_multiple caches. entity_get_controller('node')->resetCache(); } }
class EntityCacheControllerHelper extends DrupalDefaultEntityController { public static function resetEntityCache($controller, array $ids = NULL) { // Reset the persistent cache. if (!empty($ids)) { cache_clear_all($ids, 'cache_entity_' . $controller->entityType); } else { // Force all cached entries to be deleted. cache_clear_all('*', 'cache_entity_' . $controller->entityType, TRUE); } // Give modules the chance to act on any entity. foreach (module_implements('entitycache_reset') as $module) { $function = $module . '_entitycache_reset'; $function($ids, $controller->entityType); } // Give modules the chance to act on a specific entity type. foreach (module_implements('entitycache_' . $controller->entityType . '_reset') as $module) { $function = $module . '_entitycache_' . $controller->entityType . '_reset'; $function($ids); } }
entity_get_controller('node')->resetCache(); 会清空所有cache
相关推荐
包含:Drupal7宝典; Drupal开发指南; Using Drupal(强烈推荐) 值得你下载!
英文版,很新的书,值得一读。主讲drupal性能的提高。
Drupal dataDrupal data
"Enterprise Drupal 8 Development: For Advanced Projects and Large Development Teams" English | ISBN: 1484202546 | 2017 | 309 pages | PDF | 9 MB Successfully architect a Drupal 8 website that scales ...
Decoupled Drupal in Practice: Architect and Implement Decoupled Drupal Architectures Across the Stack By 作者: Preston So ISBN-10 书号: 1484240715 ISBN-13 书号: 9781484240717 Edition 版本: 1st ed. ...
drupal6的安装,drupal6的安装drupal6的安装drupal6的安装
drupal7 vs drupal6 详细的列出了从drupal6升级到drupal7所做的一些改动。 从代码,配置,UI,API等全方面的诠释drupal7与drupal6 的不同之处。
Beginning Drupal 8 teaches you how to build, maintain, and manage Drupal 8-based web sites. The book covers what Drupal is, using Drupal when building a new web site, installing and configuring Drupal...
Ideal for experienced Drupal developers, this book takes you through RWD basics and shows you how to build sites based on Aurora, Zen, and Omega—three popular base themes created by Drupal ...
Write a Drupal 8 module with custom functionality and hook into various extension points Master numerous Drupal 8 sub-systems and APIs Model, store, and manipulate data in various ways and for various...
零起点学习Drupal教程零起点学习Drupal教程零起点学习Drupal教程
Drupal 7 高级开发第三版 Drupal7专业开发指南
Drupal专业开发指南,这是drupal5版的。可能现在还有人用。
Drupal6开发手册Drupal6开发手册Drupal6开发手册Drupal6开发手册Drupal6开发手册Drupal6开发手册Drupal6开发手册
drupal-scaffold, 使用 Drupal/core更新 Drupal scaffold文件的Composer插件 ...) 插件,用于自动下载Drupal脚本文件,通过编写器使用 drupal/core 。建议在 root root的项目的标准位置放置供应商目录;但是,供应商目
Develop your programming skills by creating engaging websites using Drupal 8 About This Book Explore the new features of Drupal 8 through practical and interesting examples while building a fully ...
Drupal 的核心模块是Drupal 最重要的组成部分,它们是Drupal 主要功能的承载。Drupal 自带有33个模块,基本上涵盖了当前网站所应具有的全部功能:用户管理、博客、论坛、评论、相册以及日志管理的,还有新闻聚合等...
PHP 编程 Drupal Patch