Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cachelicious.x

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cachelicious.x

Delicious Node.js file stream cacher and HTTP cache server

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Cachelicious

Who said caching and serving cached files should be a chore?

With Cachelicious it's easier than baking a pie, and almost as delicious as eating it. Mmmmm, pie.... drool

Installation

npm install cachelicious

FS Cache Usage

var CacheliciousFs = require('cachelicious').fs;
var fsCache = new CacheliciousFs(20971520); //20MB of cache

fsCache.createReadStream(filepath, options).pipe(destination1);
fsCache.createReadStream(filepath, {start: 2, end: 100}).pipe(destination2);
//both will stream from the same cache :)

Standalone HTTP Server Usage

var CacheliciousHttp = require('cachelicious').http;

//create an HTTP cache server with 20MB to serve files from the assets directory
(new CacheliciousHttp(20971520, __dirname + '/assets')).listen(9876);	

Connect Middleware Usage

var connect = require('connect'),
    cacheliciousConnect = require('cachelicious').connect,
    http = require('http');

var app = connect()
	.use(cacheliciousConnect(__dirname + '/assets',  {maxCacheSize: 20971520}))
	.listen(3210);

Some test assets are included in the test/assets directory.

You can also try streaming video (and you should :D), like the Big Buck Bunny - http://www.bigbuckbunny.org/index.php/download/

Ranged HTTP requests are fully supported :)

Fast

APIB results serving the 641KB file in the test assets, running on a 2011 MacBook Air i7 1.8GHz (initial status - cold cache):

Standlone HTTP server test/http.js

apib -d 30 -c 200 -K 2  http://127.0.0.1:9876/medium.jpg
Duration:             30.004 seconds
Attempted requests:   53845
Successful requests:  53845
Non-200 results:      0
Connections opened:   200
Socket errors:        0

Throughput:           1794.583 requests/second
Average latency:      111.210 milliseconds
Minimum latency:      39.997 milliseconds
Maximum latency:      243.020 milliseconds
Latency std. dev:     12.224 milliseconds
50% latency:          109.000 milliseconds
90% latency:          124.159 milliseconds
98% latency:          142.353 milliseconds
99% latency:          148.804 milliseconds

Client CPU average:    0%
Client CPU max:        0%
Client memory usage:    0%

Total bytes sent:      3.71 megabytes
Total bytes received:  33792.17 megabytes
Send bandwidth:        0.99 megabits / second
Receive bandwidth:     9009.99 megabits / second

Cachelicious Connect Middleware test/connect.js

apib -d 30 -c 200 -K 2  http://127.0.0.1:3210/medium.jpg
Duration:             30.004 seconds
Attempted requests:   49598
Successful requests:  49598
Non-200 results:      0
Connections opened:   200
Socket errors:        0

Throughput:           1653.028 requests/second
Average latency:      120.535 milliseconds
Minimum latency:      46.361 milliseconds
Maximum latency:      572.141 milliseconds
Latency std. dev:     31.452 milliseconds
50% latency:          115.357 milliseconds
90% latency:          137.229 milliseconds
98% latency:          161.885 milliseconds
99% latency:          194.394 milliseconds

Client CPU average:    0%
Client CPU max:        0%
Client memory usage:    0%

Total bytes sent:      3.42 megabytes
Total bytes received:  31150.77 megabytes
Send bandwidth:        0.91 megabits / second
Receive bandwidth:     8305.67 megabits / second

Static + Static Cache Connect Middleware test/connectStatic.js

apib -d 30 -c 200 -K 2  http://127.0.0.1:4321/medium.jpg
Duration:             30.004 seconds
Attempted requests:   15000
Successful requests:  15000
Non-200 results:      0
Connections opened:   200
Socket errors:        0

Throughput:           499.940 requests/second
Average latency:      398.803 milliseconds
Minimum latency:      371.709 milliseconds
Maximum latency:      525.252 milliseconds
Latency std. dev:     24.629 milliseconds
50% latency:          390.023 milliseconds
90% latency:          431.956 milliseconds
98% latency:          475.991 milliseconds
99% latency:          505.020 milliseconds

Client CPU average:    0%
Client CPU max:        0%
Client memory usage:    0%

Total bytes sent:      1.04 megabytes
Total bytes received:  9410.90 megabytes
Send bandwidth:        0.28 megabits / second
Receive bandwidth:     2509.27 megabits / second

License

New BSD License

Contributing

Pull requests are welcome! I'll try to merge all valuable contributions and credit the author when I do so.

Keywords

FAQs

Package last updated on 13 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc