cache config instead of regenerating every time
avoid unnecessary db lookup for layer