I am working on a project where I plan on using Redis as persistent data storage, however the task at hand, I am working on a generic Object cache. and as a huge fan of LINQ I have started designing a cache which does support this.

```
    public ConcurrentBag<Object> Cache = new ConcurrentBag<object>();

    public List<T> FindBy<T>(Func<T, bool> predicate) where T : class
    {
        var tmp = new List<T>();

        foreach (var i in Cache)
        {
            try
            {
                T obj = i as T;

                if (obj != null)
                    tmp.Add(obj);
            }
            catch { }
        }

        return tmp.Where(predicate).ToList();
    }

```

I am afraid that when the object cache grows large it will become inefficient. (I estimate 500k-1m objects)

I was hoping that it would be possible to use something like this

```
    public ConcurrentBag<Object> Cache = new ConcurrentBag<object>();

    public List<T> FindBy<T>(Func<T, bool> predicate) where T : class
    {
        return Cache.Where<T>(predicate).ToList();
    }

```

Hopefully I am not all off-track here? Any suggestions are welcome :)