Vvidget Server ► Common Keys ► Caching
This section explains caching keys, which can be used by any PVS URL. The caching URLs are divided into two steps, a request URL and a response URL. You make a request directly to the Peer Visual Server to cache a response and then you embed a response URL into your web pages.
Request URL
A request URL takes this form:
http://localhost:9877/direct?1&EMAIL&chart&1&400,400&chart_type=5&chart_subtype=0&chart_format_type=1&data_values=1%203%204%205%206&fill_color=AAAA00&session_name=uhr23845d&request_name=6666&cache_instruction=store
Notice how the first part of the URL is to the localhost computer on port 9877 with a URL root of direct. By default, port 9877 is channel 0 and port 9878 is channel 1. Each of those channel and port numbers correspond to a different Peer Visual Server running on your computer. The channel number is important because the cached result will be stored within a particular server and that server must be referenced when retrieving the cache. For additional information on this issue see Direct URL.
The following table defines the keys and values for the request URL:
Request Entries | |
Key | Value Description |
session_name | A key identifying the context of the cache. Usually this is the session id of the web application server making the request to the peer visual server. |
request_name | The name of the request in the context of the session. The request_name must be unique within a particular session_name. |
cache_instruction | This is always the value "store" meaning the PVS URL response is always stored in the cache when this key and value is present. If the value is not "store" then the response is not cached. |
Response URL
Once the request is cached then a response PVS URL must be generated which references the response (result) of the request URL. An example is:
https://www.vvidget.com/graph.pvs?1&EMAIL&cache&pvs_channel=0&session_name=uhr23845d&request_name=6666
Notice that the session_name and request_name must be identical to the corresponsing Request URL.
Response Entries | |
Key | Value Description |
pvs_channel | The channel number of the original request to cache. This value is either 0 or 1. If 0 then the cache result is stored on Peer Visual Server on port 9877, if 1 then the cache result is stored on Peer Visual Server on port 9878 |
session_name | A key identifying the context of the cache. Usually this is the session id of the web application server making the request to the peer visual server. |
request_name | The name of the request in the context of the session. The request_name must be unique within a particular session_name. |
Synchronizing
The Request and Response URLs synchronize via the channel_number, session_name and request_name. Temporal synchronization is automated, meaning that either URL can be issued before the other. Usually you should issue the Request URL first because then the Peer Visual Server can compute the result of it and by the time some other process (the web browser) issues the Response URL and it is received by the Peer Visual Server the result is already generated. Because of the optimizations in the cache this can lead to a 10,000 fold or more improvement in latency while satisfying requests to the Peer Visual Server.
Hardening The Cache
Notice how the Request URL is transmitted to port 9877 or 9878 and that the Request URL can alter the cache. The Response URL is the public viewable one and it can only retrieve from the cache, not write to it. If you block port 9877 and 9878 in your firewall then no one can muck with your cache.
To learn how to delete the cache see the Admin section.