Giter Club home page Giter Club logo

appx-old's People

Contributors

drborges avatar

Watchers

 avatar  avatar  avatar

appx-old's Issues

Add cache support to queries in CachedDatastore

This feature can also be used as a throttling mechanism for queries.

The following example shows a query that will hit datastore only once every 5 seconds.

runner := appx.NewCachedDatastore(context).
    Query(query).
    CachedAs(cacheID).
    ExpiresIn(5 * time.Seconds)

In case cache id is not specified the query will not be cached at all.

Counting matched entities:

totalMatches, err := runner.Count()

Getting the matched results:

err := runner.Results(&results)

Getting the first result:

err := runner.Result(&result)

Note Reusing the same cached runner to perform different operations such as Count, Results, Result will cause the cached data to be overwritten.

Allow users to specify expiration time for cached items

Perhaps need to change the API for consistency sake and have for appx.Cacheable something similar to appx.Persistable#KeyMetadata:

type Cacheable interface {
  CacheMetadata() *CacheMetadata
}
type CacheMetadata struct {
  ID string
  ExpiresAt time.Duration
}

Support cached load in batch in CachedDatastore

LoadAll needs to:

  • Load entities in batch from the cache
  • Fall back to appx.CachedDatastore#LoadAll in case none of the entities are cached
  • Fall back to datastore for each ErrCacheMiss
  • Support appx.CacheMissQueryable entities
  • Support loading over 1000 entities at once?

In case an entity is not present neither in the cache nor in datastore, an error should be returned.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.