mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 16:35:45 +01:00
added max-age to cache control
This commit is contained in:
@@ -262,6 +262,30 @@ public abstract class AbstractManagerResource<T extends ModelObject,
|
||||
return createResponse(request, items);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getCacheMaxAge()
|
||||
{
|
||||
return cacheMaxAge;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param cacheMaxAge
|
||||
*/
|
||||
public void setCacheMaxAge(int cacheMaxAge)
|
||||
{
|
||||
this.cacheMaxAge = cacheMaxAge;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -324,6 +348,7 @@ public abstract class AbstractManagerResource<T extends ModelObject,
|
||||
{
|
||||
CacheControl cc = new CacheControl();
|
||||
|
||||
cc.setMaxAge(cacheMaxAge);
|
||||
rb.cacheControl(cc);
|
||||
}
|
||||
|
||||
@@ -395,6 +420,9 @@ public abstract class AbstractManagerResource<T extends ModelObject,
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
protected int cacheMaxAge = 1;
|
||||
|
||||
/** Field description */
|
||||
protected Manager<T, E> manager;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user