Class CachingUriFactory
The default implementation of IUriFactory which caches the URI instances it creates when InternUris is set to true.
Implements
Inherited Members
Namespace: VDS.RDF
Assembly: dotNetRdf.dll
Syntax
public class CachingUriFactory : IUriFactory
Constructors
| Edit this page View SourceCachingUriFactory()
Creates a new factory instance as a child of the root UriFactory as specified by Root.
Declaration
public CachingUriFactory()
CachingUriFactory(IUriFactory)
Creates a new factory instances as a child of the specified parent factory.
Declaration
public CachingUriFactory(IUriFactory parent)
Parameters
Type | Name | Description |
---|---|---|
IUriFactory | parent | The parent factory instance. May be null. |
Properties
| Edit this page View SourceInternUris
Get / set the flag that controls the caching of Uri instances constructed by this factory.
Declaration
public bool InternUris { get; set; }
Property Value
Type | Description |
---|---|
bool |
Remarks
When InternUris is set to true, the factory will cache each constructed URI against the original string value used for construction and return a cached Uri where available in preference to calling the Uri constructor.
Methods
| Edit this page View SourceClear()
Clears all interned URIs.
Declaration
public void Clear()
Create(string)
Creates a URI interning it if interning is enabled via the InternUris property.
Declaration
public Uri Create(string uri)
Parameters
Type | Name | Description |
---|---|---|
string | uri | String URI. |
Returns
Type | Description |
---|---|
Uri |
Remarks
When URI interning is disabled this is equivalent to just invoking the constructor of the Uri class.
Create(Uri, string)
Create a Uri instance, interning it if InternUris is set to true.
Declaration
public Uri Create(Uri baseUri, string relativeUri)
Parameters
Type | Name | Description |
---|---|---|
Uri | baseUri | The base URI to resolve |
string | relativeUri | String URI. |
Returns
Type | Description |
---|---|
Uri |
Remarks
When URI interning is disabled this is equivalent to just invoking the constructor of the Uri class.
TryGetUri(string, out Uri)
Return the interned URI instance if available.
Declaration
public bool TryGetUri(string uri, out Uri value)
Parameters
Type | Name | Description |
---|---|---|
string | uri | The string URI to return an interned URI instance for. |
Uri | value | Receives the interned Uri instance if it is available, null otherwise. |
Returns
Type | Description |
---|---|
bool | True if an interned Uri instance was found in this factory or its parent, false otherwise. |