Cache and Drupal

1,622 views

Published on

I spoke about the cache layer of Drupal at the University of Szeged.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,622
On SlideShare
0
From Embeds
0
Number of Embeds
13
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Cache and Drupal

  1. 1. Cache a Drupalban
  2. 2. A cache (pronounced /kæʃ/ ) is a collection of data duplicating original values Stored elsewhere or computed earlier, where the original data is expensive to fetch (owing to longer access time) or to compute, compared to the cost of reading the cache. Wikipedia
  3. 6. Op code caches <ul><li>APC
  4. 7. Eaccelerator
  5. 8. XCache
  6. 9. IonCube
  7. 10. Turck MMCache
  8. 11. Nusphere PhpExpress
  9. 12. Zend Optimizer+
  10. 13. Zend Platform </li></ul>
  11. 14. function node_load( $param = array() , $revision = NULL , $reset = NULL ) { static $nodes = array() ; if ( $reset ) { $nodes = array() ; } … if ( isset ( $nodes [ $param ])) { return is_object( $nodes [ $param ]) ? drupal_clone( $nodes [ $param ]) : $nodes [ $param ]; } … return $node ; }
  12. 15. cache_get( $cid , $table = 'cache' ) cache_set( $cid , $data , $table = 'cache' , $expire = CACHE_PERMANENT, $headers = NULL )
  13. 16. <ul><li>cache
  14. 17. cache_block
  15. 18. cache_content
  16. 19. cache_filter
  17. 20. cache_form
  18. 21. cache_menu
  19. 22. cache_page
  20. 23. cache_update </li></ul>
  21. 24. +------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +------------+--------------+------+-----+---------+-------+ | cid | varchar(255) | NO | PRI | | | | data | longblob | YES | | NULL | | | expire | int(11) | NO | MUL | 0 | | | created | int(11) | NO | | 0 | | | headers | text | YES | | NULL | | | serialized | smallint(6) | NO | | 0 | | +------------+--------------+------+-----+---------+-------+
  22. 25. function mymodule_schema() { $schema = array() ; $schema [ 'cache_mymodule' ] = drupal_get_schema_unprocessed( 'system' , 'cache' ); $schema [ 'cache_mymodule' ][ 'description' ] = '' ; return $schema ; }
  23. 26. Cache Router <ul><li>APC
  24. 27. Database
  25. 28. eAccelerator
  26. 29. File
  27. 30. Memcache
  28. 31. Memcached (Alpha)
  29. 32. XCache </li></ul>
  30. 33. Memcache

×