Пример #1
0
        public void Invalidate(ICacheInvalidationKey dependency)
        {
            var topic = TransformDependency(dependency);

            try {
                pubSub.Publish(topic, filter.InstanceKey);
            } catch (Exception e) {
                AppInfo appInfo = null;
                try {
                    appInfo = AppInfo.GetAppInfo();
                } catch { }
                Log.ErrorLog.LogApplicationError(new InvalidOperationException("Error invalidating cache. Check the Cache Invalidation Service status in the Environment Health page.", e), appInfo?.OsContext, "Server Side Cache");
            } finally {
                // Sending a message to invalidate local cache, without sending to RabbitMQ Server
                // This way, current application will immediatly see its cache invalidated
                filter.OnMessageReceived(new PubSubMessage(topic, "local Invalidation"));
            }
        }
Пример #2
0
 protected override string TransformDependency(ICacheInvalidationKey key)
 {
     return(key.GetKeyAsString() + RuntimePlatformUtils.CACHE_CONTROL_FILE_EXT);
 }
Пример #3
0
 protected virtual string TransformDependency(ICacheInvalidationKey key)
 {
     return(key.GetKeyAsString());
 }