I have a question to assist with my understanding of thread safety and concurrency in my .net c# application.

To take for example, reading and writing from the asp.net cache.

I am developing a high scale .net application, with interaction with the cache. 

I am aware of the different levels of concurrency, optimistic and pessimistic. However I am slightly confused what the difference between this and thread safety. 

When interacting with the cache, should I be using locks to ensure that the cache does not get manipulated by multiple threads as its being read and written to. So should I be using locks? And how does this fit in with concurrency?