[Seaside] Re: How to mark not-cacheable?

Esteban A. Maringolo emaringolo at gmail.com
Wed Jan 16 12:55:11 UTC 2008


Hi Boris,

On Jan 15, 2008 7:22 PM, Boris Popov <boris at deepcovelabs.com> wrote:
> Esteban,
>
> Check out WATransactionTest and point your browser to it via "browse -
> tests - alltests - transaction",
[SNIP]
> Isn't that the kind of expiry you are looking for?

Unfortunately, not exactly.

The WATransactionTest works in combination with (is composed by) a
WANestedTransaction, which is a WATask. The isolation in such task
works because it has a defined workflow (in the #go method), which in
each step of the flow it calls another component (via #inform:) inside
of a transaction decorator.

Suppose this example:
WAComponent subclass: #WATransactionExample
	instanceVariableNames: 'collection'.

WATransactionExample>>#initialize
	super initialize.
	collection := OrderedCollection with: 'Foo' with: 'Baz'

WATransactionExample>>renderContentOn: html
	html unorderedList
		list: collection;
		callback: [:value | collection remove: value]

The first time you render the component, it will show a list with two
items, Foo and Baz, if you click on any of them, it will remove them
properly and then render itself again with only one item (the one you
didn't remove).

But, and here comes the problem, if you go back the list will show
both elements, if you attempt to remove the already removed element,
you'll get a walkback (in this case reporting an NotFoundError).

This example is trivial, because in this case one can backtrack the
collection, but if the component interacts with a database or anything
which can't (or doesn't want) to be backtracked, the
WATransactionDecoration doesn't fit this needs.

Another option would be to associate the callback with a render pass,
or something similar.
I've read that tweaking the WALRUCache this could be achieved,
however, no one said how :-).

Best regards,

-- 
Esteban A. Maringolo
eMaringolo at gmail.com


More information about the seaside mailing list