Skip to content

Cache arbitrary queries #1

Open
@lorensr

Description

@lorensr

What to use as the cache key?

SQLDataSource uses the SQL query string:

https://github.com/cvburgess/SQLDataSource/blob/master/SQLCache.js#L19

Don't know if there's an equivalent for MongoDB. Cachegoose (caching for Mongoose) uses a hash of all these query properties:

https://github.com/boblauer/cachegoose/blob/master/src/extend-query.js#L70

Don't know if any of that is specific to Mongoose.

How to intercept queries?

Cachegoose monkeypatches mongoose.Query.prototype.exec:

https://github.com/boblauer/cachegoose/blob/master/src/extend-query.js#L6-L8

Ideally we would support the mongodb library as well.

Cachegoose also does aggregations, which we could do.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions