Beamable SDK
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Properties | List of all members
Beamable.Api.UnityUserDataCache< T > Class Template Reference
Inheritance diagram for Beamable.Api.UnityUserDataCache< T >:
Inheritance graph
[legend]
Collaboration diagram for Beamable.Api.UnityUserDataCache< T >:
Collaboration graph
[legend]

Public Member Functions

 UnityUserDataCache (string name, long ttlMs, CacheResolver resolver, IDependencyProvider provider)
 
override Promise< T > Get (long gamerTag)
 Get the given player's data. If the data does not exist in the cache yet, the CacheResolver function will be triggered to resolve the data. More...
 
override Promise< Dictionary< long, T > > GetBatch (List< long > gamerTags)
 Get multiple players' data. If the players do not have the data in the cache yet, the CacheResolver function will be triggered to resolve all the data. More...
 
override void Set (long gamerTag, T data)
 Manually set the player data More...
 
override void Remove (long gamerTag)
 Remove a player from the cache. The next time this player's data is requested, the CacheResolver will be used to get the latest data for the player More...
 
- Public Member Functions inherited from Beamable.Common.Api.UserDataCache< T >
delegate UserDataCache< T > FactoryFunction (string name, long ttlMs, CacheResolver resolver, IDependencyProvider provider)
 A general purpose factory function that returns a new instance of the UserDataCache<T>.
 
delegate Promise< Dictionary< long, T > > CacheResolver (List< long > gamerTags)
 A UserDataCache<T> has a mapping from player gamertags to some generic type per player. This function takes a set of gamertags, and fetches the latest data for each.
 

Static Public Member Functions

static UnityUserDataCache< T > CreateInstance (string name, long ttlMs, CacheResolver resolver, IDependencyProvider provider)
 

Protected Member Functions

virtual void Resolve ()
 
void PerformScheduleResolve ()
 

Protected Attributes

Dictionary< long, UserDataCacheEntrycache = new Dictionary<long, UserDataCacheEntry>()
 
List< long > gamerTagsPending = new List<long>()
 
List< long > gamerTagsInFlight = new List<long>()
 
Promise< Dictionary< long, T > > nextPromise = new Promise<Dictionary<long, T>>()
 
Dictionary< long, T > result = new Dictionary<long, T>()
 

Properties

string Name [get]
 
long TtlMs [get]
 
CacheResolver Resolver [get]
 

Member Function Documentation

◆ Get()

override Promise< T > Beamable.Api.UnityUserDataCache< T >.Get ( long  gamerTag)
inlinevirtual

Get the given player's data. If the data does not exist in the cache yet, the CacheResolver function will be triggered to resolve the data.

Parameters
gamerTagThe gamertag for the player to get data for.
Returns
A Promise<T> containing the player data.

Implements Beamable.Common.Api.UserDataCache< T >.

◆ GetBatch()

override Promise< Dictionary< long, T > > Beamable.Api.UnityUserDataCache< T >.GetBatch ( List< long >  gamerTags)
inlinevirtual

Get multiple players' data. If the players do not have the data in the cache yet, the CacheResolver function will be triggered to resolve all the data.

Parameters
gamerTagsA set of gamertags
Returns
A Promise<T> containing a dictionary from gamertag to player data

Implements Beamable.Common.Api.UserDataCache< T >.

◆ Remove()

override void Beamable.Api.UnityUserDataCache< T >.Remove ( long  gamerTag)
inlinevirtual

Remove a player from the cache. The next time this player's data is requested, the CacheResolver will be used to get the latest data for the player

Parameters
gamerTagThe gamertag of the player to remove from the cache

Implements Beamable.Common.Api.UserDataCache< T >.

◆ Set()

override void Beamable.Api.UnityUserDataCache< T >.Set ( long  gamerTag,
data 
)
inlinevirtual

Manually set the player data

Parameters
gamerTagThe gamertag of the player to set data for
dataThe player's new data, which will overwrite the old data.

Implements Beamable.Common.Api.UserDataCache< T >.


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