cache duration calculation