花瓣網的Node.Js ORM框架:Toshihiko
目前花瓣網和大搜車都有項目在用該 ORM。
使用很簡單,且在上層沒做類似于group by,join等降低效率的 API 支持,因為mysql本身效率就不是特別高。
支持三方緩存——比如 memcached,也可以自己實現一個toshihiko-xxx作為自己的緩存層。
You should create aToshihikoobject to connect to MySQL:
var T = require("toshihiko"); var toshihiko = new T.Toshihiko(database, username, password, options);
Options can include these things:
- host: hostname or IP of MySQL. Defaults tolocalhost.
- port: port of MySQL. Defaults to3306.
- cache: if you want to cache support, let it be an cache layer object or cache layer configuration which will be mentioned below. Defaults to undefined.
- etc... (All options in module mysql will be OK) </ul>
Cache
Toshihiko now is using new cache layer! You can choose your cache layer by your self!
Pass an object tocacheof options like:
var toshihiko = new T.Toshihiko(database, username, password, { cache: YOUR_CACHE_LAYER });
TheYOUR_CACHE_LAYERmay be an instance of Toshihiko cache layer object like toshihiko-memcacehd (you can implement a cache layer by yourself).
What's more,YOUR_CACHE_LAYERmay be a configuration object which should includenameorpath.
For an example,
var toshihiko = new T.Toshihiko(database, username, password, { cache: { name: "memcached", servers: "...", options: {} } });
項目主頁:http://www.baiduhome.net/lib/view/home/1426487330382
本文由用戶 y37f 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!