Exemplo n.º 1
0
 public override async Task<T> Get(Id id)
 {
     var cacheId = $"{_parent.Stream.Bucket}.{_parent.BuildParentsString()}.{id}";
     T root;
     if (!Tracked.TryGetValue(cacheId, out root))
         Tracked[cacheId] = root = await GetUntracked(_parent.Stream.Bucket, id, _parent.BuildParents()).ConfigureAwait(false);
     
     return (T)root;
 }
Exemplo n.º 2
0
        public override async Task <TEntity> New(Id id)
        {
            var cacheId = $"{_parent.Bucket}.{_parent.Id}.{id}";

            if (!Tracked.TryGetValue(cacheId, out var root))
            {
                root = await NewUnTracked(_parent.Bucket, id, _parent).ConfigureAwait(false);

                if (!Tracked.TryAdd(cacheId, root))
                {
                    throw new InvalidOperationException($"Could not add cache key [{cacheId}] to repo tracked");
                }
            }

            return(root);
        }
Exemplo n.º 3
0
        public override async Task <TEntity> Get(Id id)
        {
            var     cacheId = $"{_parent.Bucket}.{_parent.BuildParentsString()}.{id}";
            TEntity root;

            if (!Tracked.TryGetValue(cacheId, out root))
            {
                root = await GetUntracked(_parent.Bucket, id, _parent.BuildParents()).ConfigureAwait(false);

                if (!Tracked.TryAdd(cacheId, root))
                {
                    throw new InvalidOperationException($"Could not add cache key [{cacheId}] to repo tracked");
                }
            }

            return(root);
        }