diff options
| author | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-07-12 02:55:27 -0400 |
|---|---|---|
| committer | LukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com> | 2012-07-12 02:55:27 -0400 |
| commit | b50f78e5da6f3fdfc59e577ca61b88771da7d211 (patch) | |
| tree | 644ba93dc04bb8837a19a9cd5c3dfa8c6d62a91d /MediaBrowser.Controller/Library/ItemDataCache.cs | |
Initial check-in
Diffstat (limited to 'MediaBrowser.Controller/Library/ItemDataCache.cs')
| -rw-r--r-- | MediaBrowser.Controller/Library/ItemDataCache.cs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/MediaBrowser.Controller/Library/ItemDataCache.cs b/MediaBrowser.Controller/Library/ItemDataCache.cs new file mode 100644 index 000000000..35b3551a9 --- /dev/null +++ b/MediaBrowser.Controller/Library/ItemDataCache.cs @@ -0,0 +1,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;
+ }
+ }
+}
|
