# Castor JPA Extensions

This section describes all JPA-extensions provided by Castor.

## @Cache and @CacheProperty

In order to get the maximum out of the chosen built-in or external cache engine Castor provides a generic way to specify properties in a vendor-independent way. Castor allows for cache-tuning on a per-entity basis by simply providing key-value pairs with the @CacheProperty annotation in the @Cache container annnotation.

                @Entity
                @Cache({
                    @CacheProperty(key="type", value="ehcache"),
                    @CacheProperty(key="capacity", value="50")
                })
                @Table(name="Cache_limited")
                public class LimitedCachingEntity implements CacheTestEntity {

                    private long id;
                    private String name;

                    @Id
                    public long getId() {
                        return id;
                    }

                    public void setId(final long id) {
                        this.id = id;
                    }

                    public String getName() {
                        return name;
                    }

                    public void setName(final String name) {
                        this.name = name;
                    }

                }

@Cache is based on Castor JDO and uses its default settings: 'count-limited' as cache type with a capacity of 30 entries.