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

Cache AppSettings in static class #4

Merged
merged 2 commits into from Oct 2, 2015

Conversation

IDisposable
Copy link
Contributor

Since the AppDomain will automatically recycle when changes are made to the AppSettings (web.config/app.config) it is safe to cache the setting values. This ensures we only do the conversion once and allocate the byte arrays once. This will greatly reduce the number of allocations in the critical path of Filters and Attributes.

@IDisposable
Copy link
Contributor Author

Not sure of your preferred style for static stuff... could just as easily be a non-static class with a .Instance if you prefer.

daishisystems added a commit that referenced this pull request Oct 2, 2015
Cache AppSettings in static class
@daishisystems daishisystems merged commit 56ea553 into daishisystems:master Oct 2, 2015
@daishisystems
Copy link
Owner

That’s a very neat optimisation. Thank you! Static class is perfectly fine.

@daishisystems daishisystems self-assigned this Oct 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants