Closed (fixed)
Project:
Boost
Version:
6.x-1.x-dev
Component:
Expiration logic
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
5 May 2009 at 05:38 UTC
Updated:
21 Sep 2010 at 03:00 UTC
Jump to comment: Most recent file
Comments
Comment #1
mikeytown2 commentedComment #2
mikeytown2 commented#328126: Make Boost's caching views-aware
Comment #3
mikeytown2 commentedI really like this quote, as it pertains to boost
Comment #4
mikeytown2 commentedcode to make this smarter in the long run for the DB. Stolen from http://api.drupal.org/api/function/menu_get_item
Comment #5
mikeytown2 commentedForgot about linking to this
#479942: on node update, update associated term page caches as well
Comment #6
mikeytown2 commentedin order to support killing term pages, adding in a content-id column to the boost database table would be the way to go.
Comment #7
mikeytown2 commentedOn node update, flush associated term page caches as well. Works with view's
taxonomy/term/%path as well!Comment #8
mikeytown2 commentedAdded a setting in case you don't want this to happen.
Comment #9
mikeytown2 commentedcommitted.
Next:
Support panels that embed multiple nodes.
Views aware.
Comment #10
mikeytown2 commentedIn order to support views and panels, we need to create a
page_contains_thiscolumn in the database. A node has no idea where it is being used, so we need to be able to query for it in other content types; which means the data that will be stored has to be easily query-able and it has to contain multiple values. A table inside of a table is kinda whats needed.node of content type blog with a nid of 30
This can be used in multiple views & in multiple panels.
node/%&taxonomy/term/%overrides are already taken care of so this will try to deal with getting the nid out of the view.http://api.lullabot.com/ isn't much help since views & panels don't have a an api to get the nid.
If one can easily get the nid out of the view then those values would be stored in the
page_contains_thiscolumn. Anyone have any good suggestions on how to hold 1 or 10,000 nid's in the database so all effected pages can be flushed when that node changes? My current idea is to store a text blob, do a like query on it and store the NID's likenid#30, nid#31, nid#32; search forLIKE 'nid#30'to get all pages that contain the node with an nid of 30.Thoughts, hints, ideas?
Comment #11
mikeytown2 commentedThis is postponed until someone comes up with a smarter idea or a way to get the nid out of view/panels.
Comment #12
mikeytown2 commentedComment #13
mikeytown2 commentedcreate a index in the boost_cache table (call it uid). Create a new table called boost_reference; works similar to term table. 1 entry is equal to 1 reference.
Add a uid index to the boost_reference table.
boost_reference table has 5 columns.
So for a view with 6 nodes...
When a node is expired, it looks for it's own uid in the boost_reference table. Given that uid it gets the page_callback, page_arguments, page_id info. It then searches for all matches in boost_cache (WHERE = AND = AND =) and flushes them. So if the node with the boost_cache uid = 56; that node could be on multiple views. This would find all those views, and flush them (html, ajax, xml). Can also lookup the nid directly, if node was flushed.
Comment #14
mikeytown2 commentedhttp://drupal.org/node/488982 - How to access a view in a different module
http://state68.com/node/2 - Accessing Views from a custom module
http://drupal.org/node/342132 - Get the result a view creates
http://www.broadlatitude.com/blogs/matt/content/drupal-tip-never-query-c... - Drupal Tip: Never query CCK tables directly again
Comment #15
mikeytown2 commentedmd5 url and filename has to happen, can use this as a key. #575386: Table boost_cache fields size restrict the length of possible URLs
Comment #16
mikeytown2 commentedfinal piece of the puzzle is in place... #598490: Be able to expire all views, but not all nodes; ect...
Comment #17
mikeytown2 commentedFuture reference for panels
http://api.drupalecommerce.org/api/function/page_manager_page_execute/6
Hit one more snag, hopefully this is the last road block.
#598942: _boost_get_menu_router() should use menu_get_item() instead of custom code
Comment #18
mikeytown2 commentedGetting somewhere...
Get list of nodes for in the current view
Flush all nodes on this view
This means I need to store these 3 router items in the database. Node will look for it's self based a match for these 3 items, if a match is found then this view is expired from the cache. So to go along with this, I need the 3 router items of this view in the DB as well. Create a hash of all 7 items for the Primary Key (3 + 3 + 1).
Database structure
When node gets updated, looks for self in above table (child); gets all matches and flushes the parents (cached views).
Comment #19
mikeytown2 commentedCode insertion point
http://api.lullabot.com/hook_views_pre_render
Looking towards the future
http://groups.drupal.org/node/17644
http://drupal.org/project/materialized_view
http://bazaar.launchpad.net/~davidstrauss/mv/DRUPAL-6--1/files
Comment #20
mikeytown2 commentedJust need to store this in a db table. This rocks. Need to handle other objects besides nodes; one step at a time...
Comment #21
mikeytown2 commentedI may want to do a define for $GLOBALS['_boost_router_item']
Also would like to have the views hook work with Faceted Search module
Flush on node creation is the next step
Comment #22
mikeytown2 commentedIn order to flush the correct views on node creation, a list of all cached views is needed. Use that to recreate all views that are cached & see what views contain the new node. View needs to be tested with UID=0.
Get list of all cached views
Build View... something like this
Comment #23
mikeytown2 commentedcommitted; now I need to get this working with node creation.
Comment #24
mikeytown2 commentedComment #25
mikeytown2 commentedcommitted
Panels is next
http://api.drupalecommerce.org/api/function/page_manager_page_execute/6
Comment #26
mikeytown2 commentedComment #27
garywiz commentedHere is a naive observation, so take it for what it's worth.
Nodes can be rendered in views in many ways that do not always have a router table entry, such as views which render into blocks, or views which are consumed directly by modules like Quicktab.
Why not have the node record the fact that it has rendered itself within a view by:
Then, no matter why or how a node gets rendered, whether in a block or other context, it will make a record of the fact that it was rendered, and there will be a simple list for each node of which views contain cached versions of themselves.
Caveat: I am just a random passer-by here! Your way may be best! But, just throwing it out because it was the first thing that occurred to me.
Comment #28
criznach commentedAny progress on panels integration?
Comment #29
mikeytown2 commentednone but this looks like it might be of some help
http://drupal.org/node/362065
Panels support is only needed if you have a panel page. If your using "Node template" then boost will work as expected.
Comment #30
meatbag commentedsubscribing
Comment #31
mikeytown2 commentedtook some hints from #362065: Panels Override Support to get this working. Looking at the calling function http://drupalcontrib.org/api/function/ctools_context_handler_render/6 helped the most though (i needed $handler).
Comment #32
mikeytown2 commentedcommitted