I have a set of data that I need to exlude from search in my website, this array variable needs to be fetched from a table [users] different from the search table [entries] only once a day. So I have set a daily cron job to get this list, then hook this list to the search function to exlude these entries.
I would like to know which is the best way to store this array variable [excluded users] and make it accessible and persistant throughout the webapp without having to do sql queries each time, scenarios I've already thought about:
1: adding a column to the search table to mark excluded entries (undesirable, cause this might be overriden by future updates of the app).
2: hooking a second function to the search function, that joins the second table [users] and adds the WHERE NOT IN statement (undesirable, cause I am trying to minimise redundant queries to the database that will yield the same result all day)
3: Store the excluded users list in a file, then read the file each time the search function gets called (not sure if this will reduce the excution time or be lighter on resources than making the same redundant sql query)
4: having a global variable that could be accessed from inside the search class and its methodes, something that lives in the RAM , and could be altered once a day (the ideal scenario but don't know of such variables in php)