# Class: ServiceReference

## vertx-service-discovery-js/service_reference~ ServiceReference

#### new ServiceReference()

Source:
  - vertx-service-discovery-js/service_reference.js, line 29

### Methods

#### cached() → {Object}

Gets the service object if already retrieved. It won't try to acquire the service object if not retrieved yet.

Source:
  - vertx-service-discovery-js/service_reference.js, line 73

##### Returns:

the object, `null` if not yet retrieved

Type
  Object

#### get() → {Object}

Gets the object to access the service. It can be a proxy, a client or whatever object. The type depends on the service type and the server itself.

Source:
  - vertx-service-discovery-js/service_reference.js, line 59

##### Returns:

the object to access the service

Type
  Object

#### record() → {Object}

Source:
  - vertx-service-discovery-js/service_reference.js, line 41

##### Returns:

- the service record.
- Type
    Object

#### release()

Releases the reference. Once released, the consumer must not use the reference anymore. This method must be idempotent and defensive, as multiple call may happen.

Source:
  - vertx-service-discovery-js/service_reference.js, line 87