# Why must an Apex method be cacheable=true to be used with @wire, and what are the restrictions?

**Topic:** Lwc · **Difficulty:** Medium · **Tags:** lwc, apex, cacheable

Read it on the site: https://www.forcechallenges.com/interview-questions/why-must-an-apex-method-be-cacheable-true-to-be-used-with-wire-and-what-are-the-restrictions

## Answer

`@wire` may call the method many times (reactive re-provisioning), so Salesforce requires it to be **side-effect free** and caches the result on the client.

**Restrictions of `@AuraEnabled(cacheable=true)`:**
- No DML operations (insert, update, delete) in the method.
- Results are cached, so data may be stale until `refreshApex` or a cache refresh.

**If you need DML:** call the Apex method imperatively without `cacheable=true`. If data may be stale after a DML, call `refreshApex(this.wiredResult)` where `wiredResult` is the stored wire response.

---
Source: ForceChallenges · last updated 2026-10-21
