I have created some static utility methods that I use for object caching.
public static class CacheProductView {static object _ lock = new object (); Fixed string _key = "product-view"; Public stable IEnumerable & lt; Products & gt; Select () {var obj = CacheObject; If (obj == tap) {lock (_lock) {obj = CacheObject; If (obj == faucet) {obj = CreateCacheObject (); }}}}}
Here is a snippet of method that I use. As you can see, I use the classic .Net caching pattern, although I have a question about the fixed variable inside the static classes.
What is the stable phase within the stable class? For example, if I clone the class and replace 'product' for 'order', then _lock and _key objects, class or application will be scotched, obviously, if the answer is latter, giving unique names would be required.
All help and advice appreciated.
Answer your question - Fixed fields and properties per type are defined.
Great article about what type and examples go where
Apart from this - the patterns you give are not a good way to go.
No comments:
Post a Comment