Re: Re: Unique Object Instance ID..?

From: Date: Sun, 11 Jan 2009 07:22:46 +0000
Subject: Re: Re: Unique Object Instance ID..?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-286008@lists.php.net to get a copy of this message
Can you use something like APC to cache the instance variable so that it's persistent across different sessions? Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Nathan Rixham wrote: > Colin Guthrie wrote: >> 'Twas brillig, and Nathan Rixham at 10/01/09 23:31 did gyre and gimble: >>> all I need is a completely unique id for each object instance that >>> can never be repeated at any time, even in a multiserver environment >>> (and without using any kind of incremented value from a db table or >>> third party app) >>> >>> thoughts, ideas, recommendations? >> >> While it's not guaranteed to be unique the general technique used in >> these situations is to use a UUID. The chances of a clash are slim >> (2x10^38 ish combinations). >> >> You can generate a uuid via mysql "SELECT UUID()" or via the PHP Pecl >> extension php-uuid. >> >> The other way of doing it would be to insert a row into a database >> row with an auto-increment field and use the value of that >> auto-incrment field as your identifier (SELECT LAST_INSERT_ID() in >> mysql or via the db layers API). >> >> HTHs >> >> Col >> >> > > cheers for the input; uuid it has to be I guess; don't want it reliant > on any third party software or db so pecl is out, as is mysql - looks > like I'm going to have to (and probably enjoy) making a uuid function > to generate type 4 random uuids. > > only other thought is to combine all the instance variables, hash the > combination of them and save that together with a timestamp.. > > considering >

« previous php.general (#286008) next »