Interface IUriLoaderCache
Interface for Caches that can be used to cache the result of loading Graphs from URIs.
Namespace: VDS.RDF.Parsing
Assembly: dotNetRDF.dll
Syntax
public interface IUriLoaderCache
Remarks
Warning: Only available in Builds for which caching is supported e.g. not supported under Silverlight.
Implementors should take care to implement their caches such that any errors in the cache do not bubble up outside of the cache. If the cache encounters any error when caching data or retrieving data from the cache it should indicate that the cached data is not available.
Properties
| Improve this Doc View SourceCacheDirectory
Gets/Sets the Cache Directory that is in use.
Declaration
string CacheDirectory { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Non-filesystem based caches are free to return String.Empty or null but MUST NOT throw any form or error.
CacheDuration
Gets/Sets how long results should be cached.
Declaration
TimeSpan CacheDuration { get; set; }
Property Value
Type | Description |
---|---|
System.TimeSpan |
Remarks
This only applies to downloaded URIs where an ETag is not available, where ETags are available ETag based caching SHOULD be used.
Methods
| Improve this Doc View SourceClear()
Clears the Cache.
Declaration
void Clear()
GetETag(Uri)
Gets the ETag for the given URI.
Declaration
string GetETag(Uri u)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | u | URI. |
Returns
Type | Description |
---|---|
System.String |
Remarks
Calling code MUST always use the HasETag(Uri) method prior to using this method so it should be safe to throw the System.Collections.Generic.KeyNotFoundException if there is no ETag for the given URI.
Exceptions
Type | Condition |
---|---|
System.Collections.Generic.KeyNotFoundException | Thrown if there is no ETag for the given URI. |
GetLocalCopy(Uri)
Gets the path to the locally cached copy of the Graph from the given URI.
Declaration
string GetLocalCopy(Uri u)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | u | URI. |
Returns
Type | Description |
---|---|
System.String |
HasETag(Uri)
Gets whether there is an ETag for the given URI.
Declaration
bool HasETag(Uri u)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | u | URI. |
Returns
Type | Description |
---|---|
System.Boolean |
HasLocalCopy(Uri, Boolean)
Is there a locally cached copy of the Graph from the given URI which is not expired.
Declaration
bool HasLocalCopy(Uri u, bool requireFreshness)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | u | URI. |
System.Boolean | requireFreshness | Whether the local copy is required to meet the Cache Freshness (set by the Cache Duration). |
Returns
Type | Description |
---|---|
System.Boolean |
RemoveETag(Uri)
Remove the ETag record for the given URI.
Declaration
void RemoveETag(Uri u)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | u | URI. |
RemoveLocalCopy(Uri)
Removes a locally cached copy of a URIs results from the Cache.
Declaration
void RemoveLocalCopy(Uri u)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | u | URI. |
ToCache(Uri, Uri, String)
Associates an ETag (if any) with the Request and Response URIs plus returns an IRdfHandler that can be used to write to the cache.
Declaration
IRdfHandler ToCache(Uri requestUri, Uri responseUri, string etag)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | requestUri | URI from which the RDF Graph was requested. |
System.Uri | responseUri | The actual URI which responded to the request. |
System.String | etag | ETag of the response (if any). |
Returns
Type | Description |
---|---|
IRdfHandler | Either an instance of an IRdfHandler that will do the caching or null if no caching is possible. |