Re: Uniquely identifying an array... as a key to another array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2009/6/15 Eddie Drapkin <oorza2k5@xxxxxxxxx>:
> Alright, here's the situation.  I'm wrapping memcached, which takes a list
> of several servers, into a quasi-singleton.  In other words, I want only one
> instance per set of servers, not per server.
>
> Assuming I had three memcached servers at localhost, 192.168.1.1 and
> 192.168.1.2, I wouldn't want one instance per server, but given that there
> are seven possible permutations of combinations / only one server
> configuration, MemcacheConnector::$instances could be an array with seven
> objects.  I'm expecting MemcacheConnector::getInstance($array) to take an
> array formatted like 'server' => 'port'.
>
> Thusly, the question then becomes, what's the lightest possible way to store
> a unique-ish array as the key for MemcacheConnector::$instances?  Having
> MemcacheConnector::getInstance() check for
> self::$instances[serialize($serverArray)] seems a huge waste of both ram and
> CPU time.  Is there a better way?

Why not give each set of servers a name? Surely they're grouped
together for a reason, so give that reason a name.

-Stuart

-- 
http://stut.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux