SmartAPI
Open Source .NET RQL library for RedDot CMS / OpenText WSM Management Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Pages
erminas.SmartAPI.Utils.CachedCollections.ICachedList< out T > Interface Template Reference

Interface for collections of objects retrieved from the RedDot server with transparent caching. If caching is enabled the list of objects is retrieved from the server and subsequent access is done on the cache of this list. If caching is disabled the list of objects is retrieved from the server every time it gets accessed. More...

+ Inheritance diagram for erminas.SmartAPI.Utils.CachedCollections.ICachedList< out T >:
+ Collaboration diagram for erminas.SmartAPI.Utils.CachedCollections.ICachedList< out T >:

Public Member Functions

GetByPosition (int pos)
 Get an element of the list at a specific position.
 
ICachedList< T > Refreshed ()
 Calls Refresh() and returns this.
 
void WaitFor (Predicate< ICachedList< T >> predicate, TimeSpan wait, TimeSpan retryPeriod)
 Waits until a predicate on itself becomes true. Every retry period Refresh() is called and the predicate evaluated again, until the predicate evaluates to true, or the wait timespan is exhausted.
 
- Public Member Functions inherited from erminas.SmartAPI.Utils.CachedCollections.ICached
void InvalidateCache ()
 Clear the cache and refresh it on the next access.
 
void Refresh ()
 Updates the cache immediatly.
 

Properties

int Count [get]
 
bool IsCachingEnabled [get, set]
 True == caching is enabled False == caching is disabled
 

Detailed Description

Interface for collections of objects retrieved from the RedDot server with transparent caching. If caching is enabled the list of objects is retrieved from the server and subsequent access is done on the cache of this list. If caching is disabled the list of objects is retrieved from the server every time it gets accessed.

Template Parameters
TTypeId of objects in the list
Type Constraints
T :class 

Definition at line 25 of file ICachedList.cs.

Member Function Documentation

T erminas.SmartAPI.Utils.CachedCollections.ICachedList< out T >.GetByPosition ( int  pos)

Get an element of the list at a specific position.

Parameters
posPosition of the element in the list
Returns
Element at position pos
Exceptions
ArgumentOutOfRangeExceptionThrown, if pos is not a valid index>
ICachedList<T> erminas.SmartAPI.Utils.CachedCollections.ICachedList< out T >.Refreshed ( )

Calls Refresh() and returns this.

void erminas.SmartAPI.Utils.CachedCollections.ICachedList< out T >.WaitFor ( Predicate< ICachedList< T >>  predicate,
TimeSpan  wait,
TimeSpan  retryPeriod 
)

Waits until a predicate on itself becomes true. Every retry period Refresh() is called and the predicate evaluated again, until the predicate evaluates to true, or the wait timespan is exhausted.

Wait for a maximum of 5 seconds until a page with id 5 is included in the list, recheck the list every second:

    ICachedList<Page> list = ...;
    list.WaitFor(list=>list.FirstOrDefault(page=>page.Id == 5) != null, new TimeSpan(0,0,5), new TimeSpan(0,0,1));

Exceptions
TimeoutExceptionThrown if the predicate didn't evaluate to true in the given amount of time

Property Documentation

int erminas.SmartAPI.Utils.CachedCollections.ICachedList< out T >.Count
get

Definition at line 27 of file ICachedList.cs.

bool erminas.SmartAPI.Utils.CachedCollections.ICachedList< out T >.IsCachingEnabled
getset

True == caching is enabled False == caching is disabled

Definition at line 40 of file ICachedList.cs.


The documentation for this interface was generated from the following file: