blob: 35b3551a97fcb4a781101cacc26f1dd902c2eec4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
using System.Collections.Generic;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Controller.Library
{
public class ItemDataCache
{
private Dictionary<string, object> Data = new Dictionary<string, object>();
public void SetValue<T>(BaseItem item, string propertyName, T value)
{
Data[GetKey(item, propertyName)] = value;
}
public T GetValue<T>(BaseItem item, string propertyName)
{
string key = GetKey(item, propertyName);
if (Data.ContainsKey(key))
{
return (T)Data[key];
}
return default(T);
}
private string GetKey(BaseItem item, string propertyName)
{
return item.Id.ToString() + "-" + propertyName;
}
}
}
|