|
||||||||||||||||||
|
|
NetKernel provides a dependency based cache. In general resources are generated from a tree of dependent resources. If one of the resources expires then all dependent resources expire. For general processing this happens transparently and automatically. In certain circumstances, for example database queries, it is not possible to create a URI based dependency that will automatically expire. For example if a database update is performed it would be good to tell all cached previously derived results that they are no longer valid. A Golden Thread is a common dependency URI across any number of resources. It is attached with the attachGoldenThread accessor. Any number of dependents can be strung with a single golden thread URI. All will be caheable and depend directly on the validity of the Golden Thread. At any time the Golden Thread can be cut with the cutGoldenThread accessor. All resources linked by the Golden Thread will be immediately expired and the Kernel will discard cached value and/or rebuild the resources. Note: in general processing NetKernel does not require GoldenThreads to be used. It will automatically detect dependencies and invalidate dependent results if a resource expires. GoldenThreads are necessary with legacy resource sources such as relational databases where a resource may become invalid by the action of the application (an update invalidates a query result) and for which the resource is generated outside of NetKernels addressable URI space. ExampleHere's an example that attaches a Golden Thread to the results of a DB Query for customers. Note the Golden Thread URI is not a real resource it is just a URI that is unique to this Thread. NetKernel will cache the result of the query. <instr>
<type>attachGoldenThread</type> <operand>var:myCustomerQueryResult</operand> <param>goldenthread:customerDB</param> <target>var:myCustomerQueryResult</target> </instr> Suppose we now update the database. We can invalidate all results attached to the Golden Thread by cutting it... <instr>
<type>cutGoldenThread</type> <param>goldenthread:customerDB</param> </instr> All resources attached to the customerDB Golden Thread will be immediately invalidated and will be removed from the cache. (C) 2003, 1060 Research Limited |
|||||||||||||||||
|
© 2003,2004, 1060® Research Limited
1060 registered trademark, NetKernel trademark of 1060 Research Limited
|
||||||||||||||||||