private static string GetCacheId(Guid applicationId, SPListItemGetOptions options) { return(string.Join(":", new[] { "ListItems.Get", applicationId.ToString("N"), GetListItemId(options) })); }
public bool CanEdit(Guid listId, SPListItemGetOptions options) { var cacheId = CanEditCacheKey(listId, options); var canEdit = (bool?)cacheService.Get(cacheId, CacheScope.Context | CacheScope.Process); if (canEdit == null) { canEdit = listItemService.CanEdit(listId, options); cacheService.Put(cacheId, canEdit, CacheScope.Context | CacheScope.Process, new string[] { }, CacheTimeOut); } return((bool)canEdit); }
public SPListItem Get(Guid listId, SPListItemGetOptions options) { var cacheId = GetCacheId(listId, options); var listItem = (SPListItem)cacheService.Get(cacheId, CacheScope.Context | CacheScope.Process); if (listItem != null) { return(listItem); } listItem = listItemService.Get(listId, options); cacheService.Put(cacheId, listItem, CacheScope.Context | CacheScope.Process, new[] { Tag(listId) }, CacheTimeOut); return(listItem); }
private static string CanEditCacheKey(Guid applicationId, SPListItemGetOptions options) { return(string.Concat("ListItems.CanEdit:", applicationId.ToString("N"), ":", GetListItemId(options))); }
private static string GetListItemId(SPListItemGetOptions options) { return(options.ItemId.HasValue ? options.ItemId.Value.ToString(CultureInfo.InvariantCulture) : options.UniqueId.ToString("N")); }