drborges / appx-old Goto Github PK
View Code? Open in Web Editor NEWAPPengine eXtensions for golang with love :)
APPengine eXtensions for golang with love :)
This would greatly simplify the way caching entities is handled by appx.CachedDatastore
, avoiding the need of using the nasty appx.CacheableEntity
workaround
Currently it is used the JSON
codec by default. Need to provide a way of users to switch codecs as they see fit.
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.
LoadAll needs to:
appx.CachedDatastore#LoadAll
in case none of the entities are cachedErrCacheMiss
appx.CacheMissQueryable
entitiesIn case an entity is not present neither in the cache nor in datastore, an error should be returned.
For insights check this out
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
}
See this post for more information
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.