[libagilejedi commit] r18 - in trunk/AjileJedi.MemcachedForMonorail: . CustomSessionState

0 views
Skip to first unread message

codesite...@google.com

unread,
Apr 19, 2008, 2:05:10 PM4/19/08
to libagileje...@googlegroups.com
Author: Daniel.Pupek
Date: Sat Apr 19 11:04:15 2008
New Revision: 18

Modified:
trunk/AjileJedi.MemcachedForMonorail/ARSessionItem.cs
trunk/AjileJedi.MemcachedForMonorail/CustomSessionState/MemCachedSession.cs

Log:
Working on the DB persistence methods.


Modified: trunk/AjileJedi.MemcachedForMonorail/ARSessionItem.cs
==============================================================================
--- trunk/AjileJedi.MemcachedForMonorail/ARSessionItem.cs (original)
+++ trunk/AjileJedi.MemcachedForMonorail/ARSessionItem.cs Sat Apr 19
11:04:15 2008
@@ -1,17 +1,27 @@
using System;
using System.Collections.Generic;
using System.Text;
+using Castle.ActiveRecord;

namespace AgileJedi.MemcachedForMonorail
{
/// <summary>
/// Used to persist session items to a database
/// </summary>
- class ARSessionItem : Castle.ActiveRecord.ActiveRecordBase
+ [ActiveRecord]
+ public class ARSessionItem : ActiveRecordBase
{

+ private Guid _Id;
+ [PrimaryKey]
+ public Guid Id
+ {
+ get { return _Id; }
+ set { _Id = value; }
+ }
+
private byte[] _ItemData;
- [Castle.ActiveRecord.Property()]
+ [Property()]
public byte[] ItemData
{
get { return _ItemData; }
@@ -23,6 +33,27 @@
{
get { return _Item; }
set { _Item = value; }
+ }
+
+ private string _SessionId;
+ [Property]
+ public string SessionId
+ {
+ get { return _SessionId; }
+ set { _SessionId = value; }
+ }
+
+ private string _Key;
+ [Property]
+ public string Key
+ {
+ get { return _Key; }
+ set { _Key = value; }
+ }
+
+ public static ARSessionItem Find(string sessionId, string key)
+ {
+ throw new NotImplementedException();
}
}
}

Modified: trunk/AjileJedi.MemcachedForMonorail/CustomSessionState/MemCachedSession.cs
==============================================================================
---
trunk/AjileJedi.MemcachedForMonorail/CustomSessionState/MemCachedSession.cs (original)
+++
trunk/AjileJedi.MemcachedForMonorail/CustomSessionState/MemCachedSession.cs
Sat Apr 19 11:04:15 2008
@@ -243,7 +243,12 @@
return _mcClient.Get<int>(this.RevisionKey);

}
-
+ /// <summary>
+ /// Used internally to increment the session revision. The Revision
+ /// is incremented when ever the session is cleared. This revision is
+ /// used to simulate namespaces. Incrementing the revision simulates
+ /// the session being cleared.
+ /// </summary>
private void IncrementRevision()
{
_mcClient.Store(StoreMode.Add, this.RevisionKey, 1,
TimeSpan.FromMinutes(this.SessionTimeToLiveMinutes + 15));
@@ -283,6 +288,45 @@
return TimeSpan.FromMinutes(this.SessionTimeToLiveMinutes);
}
#endregion
-
+
+ #region DB Persistence Methods
+
+ /// <summary>
+ /// Persists the item to the AR layer
+ /// </summary>
+ /// <param name="key"></param>
+ /// <param name="item"></param>
+ private void PersistItem(string key, object item)
+ {
+ if (item == null) return;
+
+ // PersistItem
+ ARSessionItem arItem = new ARSessionItem();
+
+ arItem.Id = Guid.NewGuid();
+ arItem.Item = item;
+ arItem.Key = key;
+ arItem.SessionId = _sessionId;
+
+ arItem.Create();
+
+
+
+
+ }
+ /// <summary>
+ /// Retrieves the item persisted in the ActiveRecord backend
+ /// </summary>
+ /// <param name="key">The key of the item to retrieve </param>
+ /// <returns>Returns the item associated with the key. Returns null
when the item does not exist.</returns>
+ private object RetrievePersistedItem(string key )
+ {
+ ARSessionItem arItem = new ARSessionItem();
+
+ return null;
+ }
+ #endregion
+
+
}
}

Reply all
Reply to author
Forward
0 new messages