Hello, I'm trying to figure out what's a better convention for caching records in my API application. What I currently do:
public IEnumerable<T> Table(FilterDefinition<T> _Filter) => _DBSet.Find(_Filter).ToList();
public IEnumerable<T> Table(FilterDefinition<T> _Filter) => _DBSet.Find(_Filter).ToList();
Depending on the filters I have selected (list search page, finding a specific record, etc), I send that as a filter definition into the
MongoDb<T>.Find(_Filter)
MongoDb<T>.Find(_Filter)
method. Now for the sake of caching, these filter definitions would not work if I'm correct, so I would need to first load all records into Cache, then do filtering.
What's the recommended way of doing this? >Create Filter Query -> Search Db -> Get Results >Get All Results -> Create Filter Query -> Query Results