Moved library into constructor added cache expiry to status and role changes

Moved library declaration to constructor, cache expirty on status or
role change