7

The MSDN documentation doesn't explain in detail what its used for.

Since its optional, I almost assume its like metadata of some sort.

How I look at it right now, I'd like to use it as a way to specify caches for specific users only such as:

new CacheItem(key: "keyName", value: objectData, regionName: "userName")

What is the responsibility of the regionName property of the CacheItem class? What is it used for?

Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
Tom Bass
  • 362
  • 4
  • 12

2 Answers2

8

From Caching Application Data by Using Multiple Cache Objects in an ASP.NET Application (archive)

The custom class demonstrates how you would store the cached data in a named region in memory. The built-in memory cache object does not support the concept of regions but it is used in this blog to demonstrate how you would implement regions in a custom cache class. A cache region is a partition in memory that is reserved for storing one or more cache objects. A cache region helps organize cache objects in memory.

(my emphasis)

Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
fiat
  • 15,501
  • 9
  • 81
  • 103
0

The RegionName parameter in all the MemoryCache methods existed to support Microsoft's AppFabric (formerly known as Velocity) caching API.

The AppFabric API was discontinued in 2017, and Microsoft suggested moving to Redis.

So now the parameters exist as baggage, like a tombstone.

Bonus Reading

Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219