How to check session value in nginx conf

I want to improve performance of nginx when using proxy_cache, and want
to check whether customer_id exists in session, if not, I will use
proxy_cache to return the content, or else, it will request from

How can I write the config?

Tiger Huang