从url路径构建id以进行缓存

I wanted to cache our data on database or maybe on a filesystem. but im not sure how to create id from different url's.

url path: daily / time / daylight / method / location .json = "/daily/12-02-20/yes/5/london.json"

each value can be different and if one of the value is different, then i want to save new cache with new data.

any suggestion on how to make an id for each unique path for database or filesystem?

I would use a hash function to make a hash of the URL and use that as the cache ID. I do this on some of my projects for similar reasons.

sha1($url);

Which hashing function you use is up to you. PHP hashes.

it php you have use the md5 method to generate the unique id,

$url = '/daily/12-02-20/yes/5/london.json';
$id = md5($url);

and now use this $id as id for that url..