Beispiel #1
0
        private string GetVkGroupReferenceKey(IVkEntity entity)
        {
            var groupReference = (VkGroupReference)entity;
            var cacheId        = this.cachingStrategy.GetCacheId(entity, groupReference.VkGroupId.ToString(), groupReference.VkId);

            this.log.DebugFormat("Caching key generated for VkGroupReference = {0}. VkGroupId = {1}, VkId = {2}", cacheId, groupReference.VkGroupId.ToString(), groupReference.VkId);
            return(cacheId);
        }
        private string GetKey(IVkEntity entity)
        {
            Photo photo   = (Photo)entity;
            var   cacheId = this.cachingStrategy.GetCacheId(entity, photo.VkGroupId.ToString(), photo.AlbumId, photo.VkId);

            this.log.DebugFormat("Caching key generated for photo = {0}. VkGroupId = {1}, VkAlbumId = {2}, VkId = {3}", cacheId, photo.VkGroupId.ToString(), photo.AlbumId, photo.VkId);
            return(cacheId);
        }
Beispiel #3
0
        private string GetSubscriptionKey(IVkEntity entity)
        {
            var subscription = (MemberSubscriptionCollection)entity;
            var cacheId      = this.cachingStrategy.GetCacheId(entity, subscription.VkGroupId.ToString(), subscription.VkId);

            this.log.DebugFormat("Caching key generated for membersubscription = {0}. VkGroupId = {1}, VkId = {2}", cacheId, subscription.VkGroupId.ToString(), subscription.VkId);
            return(cacheId);
        }
Beispiel #4
0
        private string GetShareKey(IVkEntity entity)
        {
            var memberShare = (MemberShare)entity;
            var cacheId     = this.cachingStrategy.GetCacheId(entity, memberShare.VkGroupId.ToString(), memberShare.VkMemberId.ToString(), memberShare.ItemType.ToString(), memberShare.ItemId.ToString());

            this.log.DebugFormat("Caching key generated for membershare = {0}. VkGroupId = {1}, VkMemberId = {2}, ItemType = {3}, ItemId = {4}", cacheId, memberShare.VkGroupId.ToString(), memberShare.VkMemberId.ToString(), memberShare.ItemType.ToString(), memberShare.ItemId.ToString());

            return(cacheId);
        }
Beispiel #5
0
 public static void HandleSaveException(Exception exc, IVkEntity vkEntity, string name)
 {
     ////ILog log = Factory.GetInstance<ILog>();
     exc.Data.Add("VkGroupId", vkEntity.VkGroupId);
     exc.Data.Add("VkId", vkEntity.VkId);
     exc.Data.Add("Name", name);
     throw exc;
     ////log.ErrorFormat("Exception while saving a {4} VkGroupId=\"{0}\" VkId=\"{1}\", PostedDate=\"{2}\" exc: {3}", vkEntity.VkGroupId, vkEntity.VkId, vkEntity.PostedDate, exc.ToString(), name);
 }
Beispiel #6
0
        private string GetFullVkId(IVkEntity entity)
        {
            var fullVkId = this.idBuilder.CreateEntityId(entity.GetType().Name, entity.VkGroupId.ToString(), entity.VkId);

            return(fullVkId);
        }
Beispiel #7
0
        public string GetCacheId(IVkEntity entity, string vkMajorId, params string[] vkMinorIds)
        {
            var entityId = this.idBuilder.CreateEntityId(entity.GetType().Name, vkMajorId, vkMinorIds);

            return(entityId);
        }
Beispiel #8
0
 public void RemoveItem(IVkEntity entity, Func <IVkEntity, string> getKey)
 {
     this.cacheStorage.RemoveItem(getKey != null ? getKey(entity) : this.GetFullVkId(entity));
 }
 public void RemoveItem(IVkEntity entity, Func <IVkEntity, string> getKey = null)
 {
     this.cachingHelper.RemoveItem(entity, getKey);
 }
 public void StoreItem(IVkEntity entity, Func <IVkEntity, string> getKey = null)
 {
     this.cachingHelper.StoreItem(entity, this.GetNextExpirationDate(), getKey);
 }
 public string GetCacheId(IVkEntity entity, string vkMajorId, params string[] vkMinorIds)
 {
     return(this.cachingHelper.GetCacheId(entity, vkMajorId, vkMinorIds));
 }