Reputation: 11817
I had asked a question on how to implement real time updates in ASP.NET and received a very explanatory and a helpful answer from "jdk" at:
How to implement real time updates in ASP.NET
I understand that memcached or .net caching application block can be used as the caching layer. Currently, I am looking for a very simple mechanism to implement this and do not have the resources for using memcached or the caching application block.
Can someone suggest a solution?
Upvotes: 0
Views: 718
Reputation: 37490
This will probably cost me some rep, but I've done it and it works: consider using a singleton to cache your data.
Assuming you're looking for a global, read-only cache, and that you don't have a ton of data, you can simply have properties for each cachable element, and wrap the gets in a time check if you need to re-load the data.
Upvotes: 0
Reputation: 11626
static (as Daok has suggested) or as HttpContext.Current.Application["key"] = value;
; You wold have to remember the Type every time you "get" it
Upvotes: 0
Reputation: 1340
This book has great examples for building out an ASP.NET application using the MVP Design Pattern including a class for handling caching.
ASP.NET 3.5 Social Networking: An Expert Guide to Building Enterprise-Ready Social Networking and Community Applications with ASP.NET 3.5 by Andrew Siemer
Upvotes: 1
Reputation: 141013
I am looking for a very simple mechanism to implement this and do not have the resources for using memcached or the caching application block.
You can always store your data into Static fields. This will be shared across all users and will be alive as long as the IIS is not reseted or stopped.
Upvotes: 2