You are here

README.txt in Authenticated User Page Caching (Authcache) 7

Same filename in this branch
  1. 7 README.txt
  2. 7 modules/authcache_example/README.txt
Same filename and directory in other branches
  1. 6 modules/authcache_example/README.txt
=======================
Authcache Example Block
=======================

This module demonstrates how to create a block of user-customized content
and serve it on cached pages.

============
Installation
============

To configure, visit Site Configuration -> Blocks.

============
How it Works
============

The block itself simply grabs some user-entered text from the database.

"authcache_example.js" demonstrates how we interact with the Authcache module.

By passing the "max_age" key to Authcache's Ajax, the browser will be told to
cache the response for "max_age" seconds.  When the user updates their block,
we need to invalidate this cache, so a cookie called "authcache_example" keeps
track of the last time the block was updated (when it changes, the GET request
will change as well, giving us fresh content).

================
Development Tips
================

If you need to invalidate a block when an external update takes place
(e.g., the user does not update their block, but rather someone sends them a
private message and a "New Message" needs to appear), then a separate table
will need to be created that contains the last update timestamp.  You can use
hook_authcache_ajax() to add a value to ping the Ajax phase, then in
ajax_authcache_custom.php, add the function (named with the same value from
the hook) and query the table and update your cookie timestamp with its value
if needed. (Of course, using the caching engine instead of a database may be 
faster.)

======
Author
======

This is part of the Authcache module, developed & maintained by Jonah Ellison.

For updates, support, and documnetation, please visit:

  http://drupal.org/project/authcache

May your site be fast, your pages lean, and users happy.

File

modules/authcache_example/README.txt
View source
  1. =======================
  2. Authcache Example Block
  3. =======================
  4. This module demonstrates how to create a block of user-customized content
  5. and serve it on cached pages.
  6. ============
  7. Installation
  8. ============
  9. To configure, visit Site Configuration -> Blocks.
  10. ============
  11. How it Works
  12. ============
  13. The block itself simply grabs some user-entered text from the database.
  14. "authcache_example.js" demonstrates how we interact with the Authcache module.
  15. By passing the "max_age" key to Authcache's Ajax, the browser will be told to
  16. cache the response for "max_age" seconds. When the user updates their block,
  17. we need to invalidate this cache, so a cookie called "authcache_example" keeps
  18. track of the last time the block was updated (when it changes, the GET request
  19. will change as well, giving us fresh content).
  20. ================
  21. Development Tips
  22. ================
  23. If you need to invalidate a block when an external update takes place
  24. (e.g., the user does not update their block, but rather someone sends them a
  25. private message and a "New Message" needs to appear), then a separate table
  26. will need to be created that contains the last update timestamp. You can use
  27. hook_authcache_ajax() to add a value to ping the Ajax phase, then in
  28. ajax_authcache_custom.php, add the function (named with the same value from
  29. the hook) and query the table and update your cookie timestamp with its value
  30. if needed. (Of course, using the caching engine instead of a database may be
  31. faster.)
  32. ======
  33. Author
  34. ======
  35. This is part of the Authcache module, developed & maintained by Jonah Ellison.
  36. For updates, support, and documnetation, please visit:
  37. http://drupal.org/project/authcache
  38. May your site be fast, your pages lean, and users happy.