DataSource.NET  7.1.5.312018
Caplin.DataSource.Cache.Record.ICachedRecord Interface Reference

An Caplin.DataSource.Cache.Record.ICachedRecord contains a cache of the latest field values of a given subject More...

Inheritance diagram for Caplin.DataSource.Cache.Record.ICachedRecord:
Caplin.DataSource.Cache.ICachedObject

Properties

string this[string fieldName] [get, set]
 Gets or sets the Type1 field value for the specified fieldname. More...
 
IDictionary< string, ICachedType2RecordType2Entries [get]
 Returns a collection of Type2 cache entries for this Record. More...
 
string Type2IndexField [get, set]
 Gets or sets the type2 index field for all Type2 indices within this record. More...
 
int Type3CacheSize [get, set]
 Gets or sets the size of the type3 cache (in terms of number of entries) More...
 
IList< ICachedType3RecordType3Entries [get]
 Returns a collection of type 3 entries More...
 
- Properties inherited from Caplin.DataSource.Cache.ICachedObject
string Subject [get]
 Gets the subject of this Caplin.DataSource.Cache.ICachedObject. More...
 

Additional Inherited Members

- Public Member Functions inherited from Caplin.DataSource.Cache.ICachedObject
IMessage CreateImageMessage ()
 Creates the cache message. More...
 
IMessage CreateUpdateMessage ()
 Creates a message containing the changes since the last time this method was called. More...
 
IMessage CreateUpdateMessageWithOnlyChangedFields ()
 Creates a message containing the changes since the last time this method or CreateDeltaMessage() was called. More...
 
void Update (IMessage message)
 Updates the cache using information from the supplied Caplin.DataSource.Messaging.IMessage More...
 

Detailed Description

An Caplin.DataSource.Cache.Record.ICachedRecord contains a cache of the latest field values of a given subject

An Caplin.DataSource.Cache.Record.ICachedRecord contains a cache of the most recent image as well as a pending changeset which has yet to be applied to the cache. Setting fields using the [] operator affects the pending changeset only with the result that querying using the Caplin.DataSource.Cache.ICachedObject.CreateCacheMessage method will not include any pending field changes. Pending changes are committed using the Caplin.DataSource.Cache.ICachedObject.CreateDeltaMessage method.

The following example demonstrates how to manipulate the cache for a Record subjectype and send out an update to subscribed peers containing the changed fields.

using System;
using System.Collections.Generic;
using System.Text;
namespace DataSourceExamples.Cache
{
public class RecordType1Cache
{
void ManipulateRecordType1Cache(DataSource datasource, string subject, IPublisher publisher)
{
// Obtain the cached record for the specified subject.
ICachedRecord cacheRecord = datasource.CacheManager.GetCachedRecord(subject);
// Update the ask field.
cacheRecord["Ask"] = "213.2";
// Obtain a delta message of changed fields and send it to interested peers.
publisher.PublishToSubscribedPeers(cacheRecord.CreateUpdateMessageWithOnlyChangedFields());
}
}
}

Property Documentation

string Caplin.DataSource.Cache.Record.ICachedRecord.this[string fieldName]
getset

Gets or sets the Type1 field value for the specified fieldname.

Field value to set

When retrieving a field, the [] operator will query first the pending changeset and then the cached values

IDictionary<string, ICachedType2Record> Caplin.DataSource.Cache.Record.ICachedRecord.Type2Entries
get

Returns a collection of Type2 cache entries for this Record.

The first parameter is the type2 index name

The returned collection should be locked during any access to it.

string Caplin.DataSource.Cache.Record.ICachedRecord.Type2IndexField
getset

Gets or sets the type2 index field for all Type2 indices within this record.

The type2 index fieldname.

int Caplin.DataSource.Cache.Record.ICachedRecord.Type3CacheSize
getset

Gets or sets the size of the type3 cache (in terms of number of entries)

The size of the type3 cache.

IList<ICachedType3Record> Caplin.DataSource.Cache.Record.ICachedRecord.Type3Entries
get

Returns a collection of type 3 entries

The entries returned are not writable and the list cannot be altered


Generated on Sun Oct 21 2018 12:33:23 for DataSource.NET