SYNOPSIS

b retrieveFunction( b() defn, String(String) retriever, String key )

ARGUMENTS

defn The default function to call if the state key does not exist.

retriever A function that returns the encoded state when given the key

key The key to find the state

DESCRIPTION

In some circumstances you may need to store application state in an external source, so that a user may save their session and return to it later. This function lets you retrieve a saved state from an external source based on a key. The function represented by the saved state is then executed. The retrieval function should throw an Exception if it can't find the key, which will cause the default function defn to be executed instead. Otherwise, it should, given the key, return the state string that was stored using Webapp.storeFunction (3kaya)

One use of this is to generate links to be sent via email, where the links generated by Kaya containing the state data itself are too long to be practical.

You should consider when writing the retrieval function whether the action of retrieving the state should delete it from the persistent storage.

AUTHORS

Kaya standard library by Edwin Brady, Chris Morris and others ([email protected]). For further information see http://kayalang.org/

LICENSE

The Kaya standard library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (version 2.1 or any later version) as published by the Free Software Foundation.

RELATED

Webapp.runHandler (3kaya)

Webapp.storeFunction (3kaya)