Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move etagsCacheMaxSize to server option #99

Closed
kanongil opened this issue Oct 22, 2017 · 2 comments
Closed

Move etagsCacheMaxSize to server option #99

kanongil opened this issue Oct 22, 2017 · 2 comments
Assignees
Milestone

Comments

@kanongil
Copy link
Member

@kanongil kanongil commented Oct 22, 2017

There are 2 issues concerning the etag cache:

First, the etagsCacheMaxSize registration option is not compatible with once plugins, so the etagsCacheMaxSize needs to be moved somewhere else.

Second, since the removal of connections support means that multiple servers are likely to be created, the cache itself should be instantiated and used across multiple registrations.

The best solution I can seem to think of, is instantiating the plugin directly before registering it. Eg something like this:

const Hapi = require('hapi');
const Inert = require('inert');

const server1 = Hapi.server();
const server2 = Hapi.server();

const sharedInert = new Inert({ etagsCacheMaxSize: 500 });

server1.register(sharedInert);
server2.register(sharedInert);

@hueniverse Any thoughts on this?

@kanongil kanongil added the bug label Oct 22, 2017
@kanongil

This comment has been minimized.

Copy link
Member Author

@kanongil kanongil commented Oct 22, 2017

Maybe hapi can be changed to require plugins to be instantiated with whatever options it needs, which will avoid the multiple registration options confusion?

@hueniverse

This comment has been minimized.

Copy link
Member

@hueniverse hueniverse commented Oct 23, 2017

I think you are over thinking this. In practice, what's the harm here? And if it really a common use case to have multiple connections all serving files from the same source?

@kanongil kanongil closed this in aa3fe79 Oct 27, 2017
@kanongil kanongil changed the title Revise etags caching mechanism Move etagsCacheMaxSize to server option Oct 27, 2017
@kanongil kanongil added this to the 5.0.0 milestone Oct 27, 2017
@kanongil kanongil self-assigned this Oct 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.