I'm looking for a way to prevent developers from using some methods that are causing instability (Performance) issues for the site; for example, I have a method fetches the information from the database (e.g. getData(String id)
), and another method fetches the information form the in-memory cache (e.g. getCachedData(String id)
). The getData(String id)
method is used in getCachedData(String id)
if and only if we have a cache-miss. How can I prevent developers from using getData(String id)
method? in other words, I need to force developers to use getCachedData(String id)
always.
Please note that the access modifiers (private, protected, etc.), code design, or java docs are not
really preventing developers. Do we have a final solution for this issue?