I am developing a blog application that provides non-profit organizations. I want each organization to be able to change their own blog settings. I took the singleton template (from BlogEngine.net) and changed it. (I understand that this is no longer a singleton pattern.) I tested this approach and seems to work fine in a development environment. Is this model a good practice? Are there any problems that may arise when they are placed in a production environment?
public class UserBlogSettings { private UserBlogSettings() { Load(); } public static UserBlogSettings Instance { get { string cacheKey = "UserBlogSettings-" + HttpContext.Current.Session["userOrgName"].ToString(); object cacheItem = HttpRuntime.Cache[cacheKey] as UserBlogSettings; if (cacheItem == null) { cacheItem = new UserBlogSettings(); HttpRuntime.Cache.Insert(cacheKey, cacheItem, null, DateTime.Now.AddMinutes(1), Cache.NoSlidingExpiration); } return (UserBlogSettings) cacheItem; } } }
(Code particles were omitted for brevity.)
Thanks for any help, comment, etc.
Geri langlois
source share