Please consider this code:
public static class SomeClass
{
private static List<Item> Items;
//Constructor
public static void AddToChache(string key, object item)
{
Items.Add(new Item(){ key = key , content = item, DateAdded = DateTime.Now});
}
public static List<Item> GetAllItems()
{
return Items;
}
....
If I want to create a cache in application level, does this methods need lock
to handle concurrency?
I want to thread-safe methods.