Is there a way to clear a session cache key for all users?
You can't get all the current Sessions from all users
(Frankly speaking, you can, but I don't recommend this, and still you can read only InProc sessions
this way).
So the only thing you can do is something like this:
- Store in
Session
onlyID
of the user cart - Add item with corresponding
ID
to the Cache - Then adding the item to the
Cache
, set the dependency to the Item - Then just generate event to change whole carts in
Cache
. - Also you should think about re-creating items if for some reasons
Cache
is being emptied - you should provide theCacheItemRemovedCallback
callback for this event.