Data.TCache.Dynamic:
A dynamic interface for TCache so that mixed datatypes can be managed participating in a single transaction.
The objects are encapsulated in a IDynamic datatype, that is d Dynamic type that is serializable and indexable

Dynamic present essentially the same methods than Data.TCache. The added functionality is the management
of IDynamic types. Any datatype that is instance of IResource and Typeable can be handled mixed with any other
datatype. TCache.Dynamic is essentially a TCache working with a single datatype: IDynamic that is indexable and
serializable. You dont need to do anything special except to define Typeable besides the IResource instance for
your particular datatype. Also, before use, your datatype must be registered (with registerType, see example in the package).

there are basically two types of methods in this module:

with(STM)Resource(s) calls: manage one single type of data, in the same way than the naked Data.TCache module, Are the same than Data.TCache.
The marsalling to and from IDynamic is managed internally. These calls do exactly the same than the TCache calls with the same name
these cals allows different modules to handle their particular kind of data without regard that it is being handled in the same cache with other datatypes.

wthD(STM)Resource(s): are new, and handle the IDynamic type. The user must wrap your datatypes (with toIDyn) and unwap it (with fromIDyn)
These call permts to handle arbitrary types at the same time and partticipate in transactions.

There is also a useful Key object whose purpose is to retrieve any objecto fo any datatype by its sting key

Also the parameter refcache has been dropped from the methods that used it (the syncronization methods)

Documentation

Interface that must be defined for every object being cached.
readResource and writeResource are implemented by default as read-write to files with its key as filename
serialize and deserialize are specified just to allow these defaults. If you define your own persistence, then
serialize and deserialize are not needed. The package Workflow need them anyway.

minimal definition: keyResource, serialize, deserialize

While serialize and deserialize are agnostic about the way of converison to strings, either binary or textual, treadp and
tshowp use the monad defined in the RefSerialize package. Both ways of serialization are alternative. one is defined
by default in terms of the other. the RefSerialize monad has been introduced to permit IResource objects to be
serialized as part of larger structures that embody them. This is necessary for the Workdlow package.

The keyResource string must be a unique since this is used to index it in the hash table.
when accessing a resource, the user must provide a partial object for wich the key can be obtained.
for example:

return true for all the elems not accesed since half the time between now and the last sync

To drop from the cache all the elems not accesed since half the time between now and the last sync
ths is a default cache clearance procedure
-- it is invoke when the cache size exceeds the defined in clearSyncCacheProc

getTVars return the TVar that wraps the resources for which the keys are given .
| it return Nothing if a TVar with this object has not been allocated
These TVars can be used as usual in explicit user constructed atomic blocks
Additionally, the retrieved TVars remain in the cache and can be accessed and updated by the rest
of the TCache methods.
to keep the consistence in the serialized data, the content of the TVars are written every time the cache is syncronized with the storage until releaseTVars is called
See Data.TCache.getTVars

this is the main function for the *Resource calls. All the rest derive from it. The results are kept in the STM monad
so it can be part of a larger STM transaction involving other TVars
The Resources register returned by the user-defined function is interpreted as such:

toAdd: additional resources not read in the first parameter of withSTMResources are created/updated with toAdd

similar to Data.TCache.withSTMResources.
The return in the STM monad permits to participate in larger STM transactions
The fact that this method may return a type different that the source type permits to use ' Key' objects