<I'm in the process of spec'ing a .dll that will interface with a ServU
FTP server for the purposes of authenticating users, and I need it to be
very fast, absolutely robust (24/7/365).>

I don't know the security requirements of your application, but remember FTP
is not very secure, since it sends clear text passwords across the line.

<What I've decided to do is that when the .dll is loaded by ServU, it
will go to the database and get a list of all currently enabled users,
and their FTP permissions.>

If you're using a fast database server, I can hardly imagine implementing
such a cache would make sense. I wonder what your application will do after
the authentication. Normally that will take a multiple of the amount of time
required by authentication. So why bother making a cache that speeds up but
a small fraction of the amount of work that needs to be done?

<I'm mulling over several possibilities for the in memory solution, A
TList with pointers to the user records, maybe a daisy chain, etc. The
TList solution works if I use a TMultiReadExclusiveWriteSynchronizer and
wrap all read and write calls with that. But I'm wondering if I would
need to do that if I used a daisy chain, because I could allocate memory
for the new record, find where it fits in the daisy chain, make the
entries in the new record, and then change the previous/next record in
the daisy chain. No matter what I wouldn't delete records from memory.
There would be a flag in the record as to whether the user was enabled
or not. >

Since the VCL components are not thread safe, you'll need synchronisation to
do that. Anyway, you'd also have to implement a mechanism for invalidating a
cache entry, if a user's data has changed.
I wouldn't use a Tlist, but rather a sorted TStringList, with the data
accessed through the Objects property. A sorted TStringList is searched with
a binary search, which performs much better than the sequential search you
seem to propose.
But anyway, again, I'd forget about the cache and let the DBMS do the
searching for you.

Success!!

Peter Laman
----------------------------------
The Lance Group,
software to promote plant safety in the Process Industry
drs. Peter laman
Web: http://www.lance-safety.com

G. F. Händel was half German, half English and half Italian. He was a great
man!


__________________________________________________
Delphi-Talk mailing list -> Delphi-Talk@elists.org
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to