共用方式為


AppFabric Cache–How to check if a region exists

In an AppFabric Cache you can segregate your cached data into regions. You create a region using the CreateRegion() method of the DataCache object.

Working on a recent project I was asked How do I check if a cache exits ? There is no RegionExits() method on the DataCache object.

To check if a region exists you can make use of the CreateRegion() method.

The CreateRegion returns a bool. As per the documentation a value of true indicates that the region created successfully. A value of false indicates that the region already exists.

REF : https://msdn.microsoft.com/en-us/library/microsoft.applicationserver.caching.datacache.createregion(v=azure.10).aspx