function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
gsarguccigsargucci 

'Configuration' object design patterns or best practices

Hi,

 

I'd like to have a 'configuration' object in my Force.com app--effectively mirroring the functionality of a properties or a configuration file that you'd have in a non-cloud app.  Conceptually, I could have a singleton object that contains fields that represent the various configuration attributes, modify this object via the standard UI, and read it to access its fields as necessary.

 

However, I'd like to avoid re-reading this object for every request (I know that I can read it once and have it be available via a static variable within the context of the same request).  Is there a way to somehow 'cache' it to make it available for multiple requests without having to re-read this (perhaps only re-reading it every so often)?  Is there a best practice or a Force.com design pattern to accomplish this?  Or is this not even necessary, because the overhead of reading a single object is trivial, due to the DB's own caching?

 

Thanks!

 

Alex

 

gsarguccigsargucci

Hello again,

 

Is anyone willing to share some words of wisdom here?  Please?  :-)

 

Thanks in advance!

 

 

NaishadhNaishadh

You can achieve the same by using custom setting 

matt.ian.thomasmatt.ian.thomas
+1 on Naishadh's comment. Use custom settings for this, since you can just use .getAll() and avoid any governor limits that you would be using up if you were to go the custom object + SOQL query route. Here's some reference for custom settings if you want to read up on it: https://help.salesforce.com/apex/HTViewHelpDoc?id=cs_about.htm