Caching Questions

Veridis

New Member
Messages
16
Reaction score
0
Points
0
I have a skill calculator written in php for an online RPG I play, it gets given variables via get then makes calculations based on the input and outputs it to the user in tables.

How do I cache the results so that if more than one person inputs in the same info it will not need to run more than once. Does it make sense for me to cache it this way, as most data will be unique.

How do I cache the compiled php code?

Would I use apache, php or something else to do the caching?

I have looked at several websites that talk about caching but can't seem to make heads or tails of it all.

The URL for the script for those that are interested is: http://fay.exofire.net/syrnia/smithingcalc.php
 

Fedlerner

Former Adm & Team Manager
Community Support
Messages
12,934
Reaction score
6
Points
38
Moved to *Programming Help*
 

woiwky

New Member
Messages
390
Reaction score
0
Points
0
Why not put the calculations into JS so the server isn't bothered with it at all?
 

Veridis

New Member
Messages
16
Reaction score
0
Points
0
I'm also planning to move the data in a database soon so javascript is no good for that.
 

Veridis

New Member
Messages
16
Reaction score
0
Points
0
I assume that when you say memory cache it's a cache in the ram? I don't really know which I should use or how to implement either.

PEAR has a cache module that I may use, if I can figure out how it works and if it's installed in php v2's version of PEAR. The PEAR documentation always confuses me.
 

tittat

Active Member
Messages
2,478
Reaction score
1
Points
38
Veridis, if your are looking for memory cache it may not work at x10.Anyway mine is not a final word, some staff must respond about memory caching at x10.
 

federico_casares

New Member
Messages
49
Reaction score
0
Points
0
You could use a file cache (storing each result in a new file) and send it to the browser when the parameters match. You can use the combination of all the factors as the file name and before performing any calculation you can check if the file exists already... If it exists, then it sends it directly. If not, it makes the calc...
Or you could use a DB cache (mySQL) in a similar fashion... Memory cache? I'm not sure it's possible in a shared hosting context... Maybe yes, maybe not...

Good luck with that!
 

Veridis

New Member
Messages
16
Reaction score
0
Points
0
Veridis, if your are looking for memory cache it may not work at x10.

I don't know what I'm looking for nor what a memory cache is, so I'm afraid I can't help you there although I hope you find your answer someday.


You could use a file cache (storing each result in a new file) and send it to the browser when the parameters match. You can use the combination of all the factors as the file name and before performing any calculation you can check if the file exists already... If it exists, then it sends it directly. If not, it makes the calc...
Or you could use a DB cache (mySQL) in a similar fashion... Memory cache? I'm not sure it's possible in a shared hosting context... Maybe yes, maybe not...

Good luck with that!


That sounds interesting, I'll look into the DB cache and also if I can store files that way. Thanks for the positive advice :)
 
Top