whats the most efficient way to do this...
say i have a log file that logs actions done by members. whenever someone does something it adds a line to the file like:
username\tpassword\taction\tip\n
so this file could potentially become very large. Now, what if the admin wanted to display the last 100 actions, is there a better way to do this than to take the whole file into memory, reverse it, then print out 100 lines? Im worried about memory usage here.
fairhousing posted this at 06:10 — 28th April 2000.
They have: 1,587 posts
Joined: Mar 1999
the only other way i can think it to have the script check how many lines r on the file periodically. if there's more than 100 lines the leftovers get deleted. that way the file stays small and when u want to see the last 100 entries that's all that's there to print out, no reversing or sorting.
------------------
CLICK 4 some tested resources for making money $, hosting, and web promotions.
My Site got hacked, but i'm coming back?
Traffic-Website.com free traffic, affiliate programs, hosting, & domain names.
My Site got hacked, but i'm coming back?
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.