Evening,

I'm in the process of creating an application, part of which is a series
of CFCs which perform and cache data, allowing quick retrieval on the
next call.  This is done by passing a reference to a function to a
method of a CFC which then runs the function after doing some other
processing and returns the data.

Now I want to be able to cache the data generated.  The generated data
will be plain text and so I'm just planning on storing it (keyed on
something that uniquely identifies the funciton used) within an
structure as an instance variable in the CFC.

So basically, I need a way to generate a structure key based on a
reference to a function.  The way I've come up with is simply a hash of
the toString of the function, prefixed with an arbitrary string so the
variable name is valid, as so:

<cfset this.KEYPREFIX = "i">
<cfset key = this.KEYPREFIX & hash(myFuncRef.toString())>

Which results in a key of "i8CF622BA70E703A796DB0FD8AC8ABFA8" -- a valid
variable name and unique to the function called.

The myFuncRef.toString() returns an output similar to
"[EMAIL PROTECTED]" which is basically the
associated compiled java class.  AFAIK this uniquely identifies the
function being used and means I don't have to manually associate an ID
with each function.  The hash() + the string prefix call makes sure that
any invalid chars get removed and the chance of two hash() calls
returning the same value is supposedly around 1 in 2^64 so it should be
safe there...

Basically, does anyone see any issue with doing it this way?

Tim.


-------------------------------------------------------
RAWNET LTD - Internet, New Media and ebusiness Gurus.
Visit our new website at http://www.rawnet.com for
more information about our company, or call us free
anytime on 0800 294 24 24.
-------------------------------------------------------
Tim Blair
Web Application Engineer, Rawnet Limited
Direct Phone : +44 (0) 1344 393 441
Switchboard : +44 (0) 1344 393 040
-------------------------------------------------------
This message may contain information which is legally
privileged and/or confidential.  If you are not the
intended recipient, you are hereby notified that any
unauthorised disclosure, copying, distribution or use
of this information is strictly prohibited. Such
notification notwithstanding, any comments, opinions,
information or conclusions expressed in this message
are those of the originator, not of rawnet limited,
unless otherwise explicitly and independently indicated
by an authorised representative of rawnet limited.
-------------------------------------------------------


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

Reply via email to