dashron / roads-models Goto Github PK
View Code? Open in Web Editor NEWA Node.js model system for mysql and redis
License: MIT License
A Node.js model system for mysql and redis
License: MIT License
add a "parallel" function, kinda like promises.
model1.load(id)
.parallel(function () {
return model2.load(id);
})
.ready(function (item1, item2) {
})
I don't necessarily like the spec of he ready callback, code might be overly complex to achieve the correct order.
memcache
postgres
Predefine simple collections so that we can auto cache update them.
UserModule.collections['all'] = 'select id from users';
default onSave updates the all collection.
if (callback._error) {
callback._error(err);
}
else {
callback(err);
}
don't force users to use bind. it adds extra unnecessary computation. we can assume the _error pattern exists because we often will be chaining request promises
Sorts are applied after the onSave callback is fired, so if you end in save.ready() the sorts will never execute
Look into the mysql pooling and....
http://archive.coreservlets.com/Chapter18.html
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=%2Frzaha%2Fpoolnods.htm
on getConnection()....
if connection[0] is connected and ready, perform request
if connection[0] is connected and not ready, if connection.length <
max_connections, create connection and perform request, otherwise
queue up request
if connection[0] is not connected, shift off array and attempt the new
connection[0]
model.js: turns the sort into an order by statement
cachedmodel.js: uses an alternate cache key, which uses a sorted set
This sort stuff should be built into the buildCacheKey function so that onSave we can keep the sorted set up to date.
let mysql do the initial sorting for now.
so that it goes through the validation handler and doesn't end up being a db error
it would be cool if we could also bubble mysql errors through the validation handler
model.js : should simply turn the pagination into a limit
cachedmodel.js: should be filtered at the locateModels level. Keep every id cached in the set, but filter down the data when you pull the full model data.
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.