My favorite approach is to store them all in a data warehouse and have only one master record with all the various properties and itβs good to use memcache. By doing this, you do not need to have different configuration files or pollute your code with various configuration settings. Instead, you can expand and change these values ββfrom the administrative form that you will need to create in order to update this master record.
In addition, if you save tokens and secret keys, then you are aware that it is definitely not recommended to have them in web.xml or elsewhere in the code, but rather to have it for an application for something more secure, like storage data.
After that, you can have one global function that will retrieve properties by name, and if you want to get the Google Analytics identifier from anywhere in your application, you should use it with something like this:
getProperty('googleAnalyticsID')
where this global getProperty() function will try to find this value using the following steps:
- Check if memcache exists and returns
- If not in memcache, upgrade memcache from the main object from the data store and return
- If an object with default values ββis not created in the data store, update memcache and return
Of course, there are different approaches to extracting data from this model, but the idea is the same: Store in one record and use memcache.
source share