Gets a value cached for a particular key, updating the value if necessary.
Namespace: net.openstack.Core.CachingAssembly: openstacknet (in openstacknet.dll) Version: 1.7.7+Branch.master.Sha.25d803f397c8693c2c13777ef6675f796f520f2c
Syntax T Get(
string key,
Func<T> refreshCallback,
bool forceCacheRefresh = false
)
Function Get (
key As String,
refreshCallback As Func(Of T),
Optional forceCacheRefresh As Boolean = false
) As T
T Get(
String^ key,
Func<T>^ refreshCallback,
bool forceCacheRefresh = false
)
abstract Get :
key : string *
refreshCallback : Func<'T> *
?forceCacheRefresh : bool
(* Defaults:
let _forceCacheRefresh = defaultArg forceCacheRefresh false
*)
-> 'T
Parameters
- key
- Type: SystemString
The key. - refreshCallback
- Type: SystemFuncT
A function which returns a new value for the specified key, or if no update function available (see remarks). - forceCacheRefresh (Optional)
- Type: SystemBoolean
If , the value associated with key will be always be refreshed by calling refreshCallback, even if a value is already cached.
Return Value
Type:
T
The cached value associated with the specified
key. If no cached value is
available (see remarks), the method returns the default value for
T.
Exceptions Remarks
This method returns a previously cached value when possible. If any of the following
conditions are met, the
refreshCallback function will be called to
obtain a new value for
key which is then added to the cache,
replacing any previously cached value.
- The cache does not contain any value associated with key.
- forceCacheRefresh is .
- The previously cached value for key is no longer valid. The exact
algorithm for determining whether or not a value is valid in implementation-defined.
If any of the above conditions is met and refreshCallback is ,
the previously cached value for key, if any, is removed from the cache
and the default value for T is returned.
Version Information .NET Framework
Supported in: 4.5
openstack.net
Supported in: 1.6, 1.5, 1.4, 1.3.6
See Also