Cannot access kv namespace

Im trying to make a cache system using kv namespace in wrangler and im trying to acesss it like so env.name.get('key') but it gives reference error env not defined. also i have added the namespace name, id and preview_id to wrangler.toml file
help pls
Was this page helpful?