I have a table that caches data (shared hosting so no memcached) to a MySQL table.
The concept is this:
I have a page that loads (static) data and then cache then:
- If the cache does not exist then it queries the page then render the HTML and save it to the cache table.
- If a page does not exist in cache, it executes 12 queries (menu, page content, SEO, product list, etc.) then saves the rendered HTML in the table.
The cache table is like this:
=cache=
url varchar(255) - primary key
page mediumtext
Now I think I'm doing the right thing, based on what I have (shared host, no caching like memcached, etc.) but my question is this:
Because the URL is a varchar
index but because numeric IDs (like int
) are faster, is there a way to convert a URL like /contact-us/
or /product-category/product-name/
to a unique integer? Or is there any other way to optimize this?