Was this page helpful?

WebCache

    Vendor MindTouch
    Type Native
    Categories Misc
    Requires MindTouch 9.02 or later
    OS Restriction None
    Status Stable
    License Free/Open Source
    SID (service id) sid://mindtouch.com/2009/02/extension/webcache
    Assembly mindtouch.deki.services

    Install Extension

    URL of your MindTouch install (ex: http://www.mindtouch.com)
        

     

    Table of Contents

    Description

    The WebCache service replicates a number of functions built into DekiScript in the web namespace. The only visible difference between the regular functions and their webcache counterparts is that the cache ttl parameter has a minimum of 300 (5 minutes) and no upper bound. Functionally, webcache will store cached documents on disk rather than memory, although documents are kept temporarily in memory so that frequent accesses do not have to incur disk overhead on each subsequent calls.

    See also How to add an extension, Using the Extension Dialog, Learn about DekiScript, Extensions Directory.

    Configuration

    The WebCache does not require any additional configuration, but its behavior can be altered with the following keys

    Config Key Description
    max-size Maximum size (in bytes) of documents that can be cached
    memory-cache-time Amount of time a document added to the disk cache or retrieved from the disk cache remains in memory before it has to be re-fetched from disk

    Additional Information

    As for every extension, the webcache extension can be added several times, e.g. for different servers. To accomplish this, set the service preference "namespace". If it is set e.g. to "mysvn", the subversion service is being invoked by mysvn.table(...). If all repositories are on the same server, this is not needed, use the parameter "path" (see below) for this.

    Functions

    webcache.Clear( source: str ) : any

    Removes the document source from the disk cache

    Parameters:

    Name Type Description
    source uri Uri of the document to remove from the disk cache

    webcache.Html

    Counterpart to web.Html

    webcache.Json

    Counterpart to web.Json

    webcache.List

    Counterpart to web.List

    webcache.Text

    Counterpart to web.Text

    webcache.Xml

    Counterpart to web.Xml

    webcache.Store( id: str, document : any, ttl : num )

    Version: 9.08 or later

    Store any DekiScript variable or output of any DekiScript function for later retrieval. The storage is a cache, i.e. it is not meant as persistent storage, and values will be removed from the cache once the ttl expires. Storing a value at an existing id, will overwrite the current value and reset the cache expiration.

    Parameters:

    Name Type Description
    id str a unique identifier for the document to be stored
    document any any DekiScript value to be stored
    ttl num (optional, range: 300+, default: 300) Caching duration in seconds

     

    Output: any (the document submitted for storage)

    webcache.Fetch( id: str )

    Version: 9.08 or later

    Retrieve a previously stored value from the cache

    Parameters:

    Name Type Description
    id str  the unique identifier for the document provided at storage time

     

    Output: any (the document submitted via webcache.store() )


    Source Code

    
            
    

    Development log

    reference to undefined name 'svn' Exception of type 'MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException' was thrown. (click for details)
    Was this page helpful?
    Tag page
    Viewing 2 of 2 comments: view all
    Hi, the section additional information is not clear. If I have a multi-tenant installation on the same server do I have to use different namespace?
    Posted 13:58, 3 May 2010
    @intertesto depends how you setup the service. if each instance has its own copy via the control panel, then they will be cached independently. if, however, you share the extension as a remote extension, then they all share the same cache and you have to make sure to use a different caching key
    Posted 17:35, 3 May 2010
    Viewing 2 of 2 comments: view all
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by