// New returns a new ActivityPub client.
New returns a new ActivityPub client.
// New returns a new ActivityPub client .
func New(cfg Config, t httpTransport) *Client {
	c := &Client{
		httpTransport: t,
	}
	cacheSize := cfg.CacheSize
	if cacheSize == 0 {
		cacheSize = defaultCacheSize
	}
	cacheExpiration := cfg.CacheExpiration
	if cacheExpiration == 0 {
		cacheExpiration = defaultCacheExpiration
	}
	logger.Debugf("Creating actor cache with size=%d, expiration=%s", cacheSize, cacheExpiration)
	c.actorCache = gcache.New(cacheSize).ARC().
		Expiration(cacheExpiration).
		LoaderFunc(func(i interface{}) (interface{}, error) {
			return c.getActor(i.(*url.URL))
		}).Build()
	c.publicKeyCache = gcache.New(cacheSize).ARC().
		Expiration(cacheExpiration).
		LoaderFunc(func(i interface{}) (interface{}, error) {
			return c.getPublicKey(i.(*url.URL))
		}).Build()
	return c
}
func New ( cfg Config , t httpTransport ) * Client { c := & Client { httpTransport : t , } cacheSize := cfg . CacheSize if cacheSize == 0 { cacheSize = defaultCacheSize } cacheExpiration := cfg . CacheExpiration if cacheExpiration == 0 { cacheExpiration = defaultCacheExpiration } logger . Debugf ( " " , cacheSize , cacheExpiration ) c . actorCache = gcache . New ( cacheSize ) . ARC ( ) . Expiration ( cacheExpiration ) . LoaderFunc ( func ( i interface { } ) ( interface { } , error ) { return c . getActor ( i . ( * url . URL ) ) } ) . Build ( ) c . publicKeyCache = gcache . New ( cacheSize ) . ARC ( ) . Expiration ( cacheExpiration ) . LoaderFunc ( func ( i interface { } ) ( interface { } , error ) { return c . getPublicKey ( i . ( * url . URL ) ) } ) . Build ( ) return c }
New returns a new ActivityPub client.
New returns a new ActivityPub client .