[typo] Rethinking Content Whiteboards
Scott Laird
scott at sigkill.org
Thu Sep 28 13:42:10 EDT 2006
Sounds good.
After watching my logs yesterday, I'm seriously considering ditching a
lot of the sweeper implementation and switching to something like
this:
if Article, Page, or Settings changed -> sweep everything
elsif Comment or Trackback -> sweep page, add +60 minute trigger to
sweep everything if one doesn't already exist.
We should probably also add a 'if comment is published' in there
somewhere, because even spam comments are nuking my cache.
Scott
On 9/28/06, Piers Cawley <pdcawley at bofh.org.uk> wrote:
> At the moment we're holding whiteboards as a serialised field in
> contents table. Which was fine when we were also caching the HTML
> representations there too -- whiteboards generally got (re)generated
> during text formatting and got magically saved along with the html
> renderings.
>
> But now, the rendered html is managed by the controller and held in
> a different sort of cache, so the article doesn't get saved, so the
> whiteboard data gets thrown away. Which is not good.
>
> So, my thinking is add something like:
>
> class Whiteboard
> serialize :data
>
> def method_missing(:method, *args)
> method.to_s =~ /^(.*)(=?)$/
> key = $1
> is_assignment = !$2.blank?
>
> unless data.has_key? key
> return super(:method, *args)
> end
>
> if is_assignment
> data[key] = *args
> else
> data[key]
> end
> end
> end
>
> And having a table definition like
>
> create_table :whiteboards do |t|
> t.column :name, :string
> t.column :data, :text
> end
>
> The tricky part might be in getting a working acts_as_hash
> implementation, but that's a SMOP.
>
> Thoughts?
>
> --
> Piers Cawley <pdcawley at bofh.org.uk>
> http://www.bofh.org.uk/
> _______________________________________________
> Typo-list mailing list
> Typo-list at rubyforge.org
> http://rubyforge.org/mailman/listinfo/typo-list
>
More information about the Typo-list
mailing list