Most efficient method of storing large array of IP address within WP for easy retrieval? [closed]

Question

I need to store a large number of whitelisted IP ranges and retrieve them when any user first visits the site. (People on a white listed IP can see protected content.)

The array looks something like this, but MUCH longer:

<?php $IP_ranges = array 
     (
     array("low_ip ","high_ip "),
     array("low_ip ","high_ip "),
     array("low_ip ","high_ip "),
     //etc
     ); ?>

There could be as many as couple of thousand IP ranges in the array. My first instinct is to store them as a transient so that they are super easy to retrieve, but then I’m worried if that would cause problems with too much clutter in the wp_options table.

The other option I thought of was to store them as post content in a hidden custom post type. Just a single post, which I’d have to query when anyone first visits the site. This seems better for the options table but maybe a bit slower because of the query?

Looking for advice on how to do this most efficiently and using minimal server resources.

Thanks.

--------------------------------------------------

>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="https://www.wptricks.com/question/most-efficient-method-of-storing-large-array-of-ip-address-within-wp-for-easy-retrieval-closed/">

Most efficient method of storing large array of IP address within WP for easy retrieval? [closed]</a>
0
, , , Josh M 2 weeks 0 Answers 10 views 0

Leave an answer