Click here to Skip to main content
15,882,658 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
GeneralHigh Level Design for Installation and Upgrade Application Pin
Brady Kelly6-Mar-09 8:49
Brady Kelly6-Mar-09 8:49 
GeneralRe: High Level Design for Installation and Upgrade Application Pin
Jonathan Davies8-Mar-09 4:11
Jonathan Davies8-Mar-09 4:11 
GeneralRe: High Level Design for Installation and Upgrade Application Pin
Brady Kelly8-Mar-09 4:25
Brady Kelly8-Mar-09 4:25 
GeneralRe: High Level Design for Installation and Upgrade Application Pin
Jonathan Davies8-Mar-09 5:25
Jonathan Davies8-Mar-09 5:25 
GeneralRe: High Level Design for Installation and Upgrade Application Pin
Brady Kelly8-Mar-09 5:47
Brady Kelly8-Mar-09 5:47 
QuestionCache Manager design problem Pin
Steve Holdorf28-Feb-09 9:07
Steve Holdorf28-Feb-09 9:07 
QuestionRe: Cache Manager design problem [modified] Pin
Steve Holdorf28-Feb-09 14:34
Steve Holdorf28-Feb-09 14:34 
AnswerRe: Cache Manager design problem Pin
Steve Holdorf1-Mar-09 9:53
Steve Holdorf1-Mar-09 9:53 
Now, the cache manager handles dependencies. See below:

// Main delegate on which all Get requests are based on.
public delegate object QueryExpression(params object[] parameters);

// Main delegate on which all insert requests are based on.
public delegate object InsertExpression(params object[] parameters);

/// <summary>
/// Summary description for CacheManager
/// </summary>
public class CacheManager
{

    public TimeSpan CacheDuration { get; set; }
    private static object syncObject = new object();
    private bool CachingEnabled = true;

    private bool HasKey(string Key)
    {            
        return ((Object)HttpRuntime.Cache[Key] != null);
    }

	private Object CacheItem(string sCacheKey)
    {
        return (Object)HttpRuntime.Cache[sCacheKey];
    }

    public object GetCacheItem(QueryExpression QueryExpression, params object[] param)
    {
        object objCacheItem = null;

        if (!CachingEnabled)
        {
            return objCacheItem;
        }

        if (CacheItem((string) param[0]) != null)
        {
            return CacheItem((string) param[0]);
        }
        else
        {
            lock (syncObject)
            {
                if (CacheItem((string)param[0]) != null)
                {
                    return CacheItem((string) param[0]);
                }
                else
                {
                    Object cacheItem = QueryExpression(param);

                    DateTime expiration = DateTime.Now.Add(new TimeSpan (6000));

                    HttpContext.Current.Cache.Add((string) param[0], (List<string>) cacheItem, null, expiration,
                        TimeSpan.Zero, System.Web.Caching.CacheItemPriority.Default, null);

                    return cacheItem;
                }
            }
        }
    }

    public Object InsertInCache(InsertExpression insertExpression, params object[] param)
    {
        System.Web.Caching.CacheDependency cacheDependency;

        string[] dependencyKey = { (string) param[1] };

        if (HasKey((string) param[0]))
        {
            return CacheItem((string)(param[0]));
        }

        DateTime expiration = DateTime.Now.Add(new TimeSpan (6000));

        cacheDependency = new System.Web.Caching.CacheDependency(null, dependencyKey);

        HttpContext.Current.Cache.Add((string) param[0], insertExpression(param), 
            (param[1] == "" ? null : (cacheDependency)), expiration, 
                        TimeSpan.Zero, System.Web.Caching.CacheItemPriority.Default, null);

        return CacheItem((string)(param[0]));
    }
}

QuestionReverse engineering the vc++ project Pin
hariakuthota19-Feb-09 22:28
hariakuthota19-Feb-09 22:28 
AnswerRe: Reverse engineering the vc++ project Pin
bobbery19-Feb-09 23:12
bobbery19-Feb-09 23:12 
AnswerRe: Reverse engineering the vc++ project Pin
Han van Roosmalen3-Mar-09 20:55
Han van Roosmalen3-Mar-09 20:55 
QuestionResource Allocation Logic Pin
Nagarajan Mohan18-Feb-09 2:52
Nagarajan Mohan18-Feb-09 2:52 
QuestionDesign question about layers and MVC Pin
Fernando A. Gomez F.14-Feb-09 11:56
Fernando A. Gomez F.14-Feb-09 11:56 
AnswerRe: Design question about layers and MVC Pin
Jonathan Davies18-Feb-09 3:11
Jonathan Davies18-Feb-09 3:11 
Question.net Serializable DTO Pin
mokrala12-Feb-09 6:14
mokrala12-Feb-09 6:14 
QuestionBuilding a relational graph from a large build enlistment Pin
Adam Dare9-Feb-09 18:01
Adam Dare9-Feb-09 18:01 
AnswerRe: Building a relational graph from a large build enlistment Pin
Jonathan Davies18-Feb-09 3:22
Jonathan Davies18-Feb-09 3:22 
GeneralRe: Building a relational graph from a large build enlistment Pin
Adam Dare18-Feb-09 4:44
Adam Dare18-Feb-09 4:44 
GeneralRe: Building a relational graph from a large build enlistment Pin
Jonathan Davies19-Feb-09 3:03
Jonathan Davies19-Feb-09 3:03 
QuestionHow to play an Animation and make video render before logon through credential provider ?(Vista) [modified] Pin
wyc_xiaoben4-Feb-09 15:07
wyc_xiaoben4-Feb-09 15:07 
QuestionWhat pattern should I use? Pin
nickiii3-Feb-09 5:17
nickiii3-Feb-09 5:17 
AnswerRe: What pattern should I use? Pin
Jon Rista3-Feb-09 10:55
Jon Rista3-Feb-09 10:55 
GeneralRe: What pattern should I use? Pin
nickiii3-Feb-09 13:01
nickiii3-Feb-09 13:01 
Questionbus address converter Pin
aswd30-Jan-09 7:46
aswd30-Jan-09 7:46 
JokeRe: bus address converter Pin
Jon Rista3-Feb-09 10:56
Jon Rista3-Feb-09 10:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.