Đối phó với Cache trong Drupal 6

Để tối ưu cho việc thực thi và tải trang, Drupal 6 có cung cấp sẵn một số công cụ hữu ích: nén các tập tin css, nén các tập tin javascript, nén trang tải về, đưa các hàm giao diện vào registry, đệm menu, đệm block, ...

Các tính năng này thật sự hữu ích khi site đã chính thức đi vào hoạt động. Tuy nhiên, đối với hệ thống đang được phát triển thì có lẽ việc đệm nội dung là không cần thiết, lắm khi là phiền toái. Có một vài cách để đối phó:

1. Sử dụng module cache_disable

Module này chỉ làm nhiệm vụ là clear cache sau mỗi request được thực hiện.

2. Xóa đệm bằng hàm:

có thể sử dụng các hàm sau để xoá nội dung đệm

* drupal_rebuild_theme_registry():
Xoá theme registry

* cache_clear_all():
Xóa các nội dung quá hạn ra khỏi đệm. Nếu hàm được gọi không có tham số truyền vào các mục quá hạn từ bảng cache_page và cache_block sẽ được xoá.

* menu_rebuild():
(Re)populate the database tables used by various menu functions.

* drupal_flush_all_caches():
Xóa đệm CSS, xoá đệm Javascript, xoá theme registry, xây dựng lại bảng menu, xây dựng lại các thông số của các node type, kết hợp hook_flush_caches của các module xóa các dữ liệu đệm khác.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <sup> <br> <p> <h3>
  • Lines and paragraphs break automatically.
  • Link to content with [[some text]], where "some text" is the title of existing content or the title of a new piece of content to create. You can also link text to a different title by using [[link to this title|show this text]]. Link to outside URLs with [[http://www.example.com|some text]], or even [[http://www.example.com]].
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

More information about formatting options

CAPTCHA
This question is used to make sure you are a human visitor and to prevent spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.