Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Blake Niemyjski
@niemyjski
just thought of something
var valueMap = new Dictionary<string, CacheValue<T>>();
we could put the old dictionary length in the constructor so if it’s a huge existing dictionary we won’t be changing the size internally every 2^nth
Eric J. Smith
@ejsmith
where is that for?
Blake Niemyjski
@niemyjski
in the scoped cache client
I’m going to make that change real quick
Eric J. Smith
@ejsmith
that only works for in memory implementations, no?
Blake Niemyjski
@niemyjski
no
all of them
hmm
ToDictionary overload doesn’t look at the count
when creating it
Eric J. Smith
@ejsmith
how would you know how many items are in reds?
redis
Blake Niemyjski
@niemyjski
it does a getall
and then iterates over that..
Eric J. Smith
@ejsmith
huh???
Blake Niemyjski
@niemyjski
    public async Task<IDictionary<string, CacheValue<T>>> GetAllAsync<T>(IEnumerable<string> keys) {
        var scopedDictionary = await UnscopedCache.GetAllAsync<T>(GetScopedCacheKeys(keys)).AnyContext();
        return scopedDictionary.ToDictionary(kvp => UnscopeCacheKey(kvp.Key), kvp => kvp.Value);
    }
Eric J. Smith
@ejsmith
ohhh
the getall method
Blake Niemyjski
@niemyjski
hmm
Eric J. Smith
@ejsmith
you really think someone is calling that with that many items?
Blake Niemyjski
@niemyjski
eh by default it’s all keys
Eric J. Smith
@ejsmith
pretty sure the default size will cover it.
Blake Niemyjski
@niemyjski
but the ToDictionary doesn’t set it so I guess when someone hits that issue we’ll fix it
I think it starts really low
like 4, and then resizes by a base 2
if I remember correctly
doubles every resize
Blake Niemyjski
@niemyjski
build just failed and I was looking at the logs
I just noticed the last version of grunt was released in 2014
Jamie Clarke
@jamie94bc
good call @niemyjski
that's why i'm using gulp ;)
Blake Niemyjski
@niemyjski
was picked up by jQuery foundation. and they got like 5 new contributors and just released an rc of 1.0
so that’s good
eh when I started gulp was pretty new
kinda pissed
got 70% done with the ui rewrite and aurelia and gulp really took off
Jamie Clarke
@jamie94bc
        public static Dictionary<TKey, TElement> ToDictionary<TSource, TKey, TElement>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, IEqualityComparer<TKey> comparer) {
            if (source == null) throw Error.ArgumentNull("source");
            if (keySelector == null) throw Error.ArgumentNull("keySelector");
            if (elementSelector == null) throw Error.ArgumentNull("elementSelector");
            Dictionary<TKey, TElement> d = new Dictionary<TKey, TElement>(comparer);
            foreach (TSource element in source) d.Add(keySelector(element), elementSelector(element));
            return d;
        }
Blake Niemyjski
@niemyjski
yeah
Jamie Clarke
@jamie94bc
that's implementation from reference source
which is why i didn't use it
Blake Niemyjski
@niemyjski
I saw that too
we could switch it back.. but wonder if we gotta worry about that? guess wait till we see an issue instead of preoptmizing?
Jamie Clarke
@jamie94bc
if you've already made the change leave it for now!
i'm having fun with SQL joins and exists - deciding to do the join before exists
which is bad news
Blake Niemyjski
@niemyjski
:(
Jamie Clarke
@jamie94bc
i think it's because i have an or condition - ie. if column = x or exists
nice when things go from minutes to milliseconds though! :smiley: