You are here

public function CampaignMonitor::removeSubscriberFromCache in Campaign Monitor 7

Remove subscribers from local cache.

This forces the data to be fetched from Campaign Monitor at the next request. This function should be used in connection with updating subscriber information.

Parameters

string $list_id: The unique Campaign Monitor list ID.

string $email: The e-mail address to be removed from cache.

3 calls to CampaignMonitor::removeSubscriberFromCache()
CampaignMonitor::subscribe in lib/campaignmonitor.class.inc
Subscribe a user to a given list, with information entered.
CampaignMonitor::unsubscribe in lib/campaignmonitor.class.inc
Unsubscribe a given user, identified by e-mail address, from a given list.
CampaignMonitor::updateSubscriberEmail in lib/campaignmonitor.class.inc
Updates the subscriber e-mail address for a given list.

File

lib/campaignmonitor.class.inc, line 897
Implementation of the CampaignMonitor class.

Class

CampaignMonitor
Implementation of the CampaignMonitor class.

Code

public function removeSubscriberFromCache($list_id, $email) {
  if (($cache = cache_get('campaignmonitor_subscribers')) && !empty($cache->data)) {

    // Cache information found.
    $this->subscribers = $cache->data;
    if (isset($this->subscribers[$list_id . $email])) {

      // Subscriber found in the cache, so remove it.
      unset($this->subscribers[$list_id . $email]);
      cache_set('campaignmonitor_subscribers', $this->subscribers, 'cache', $this
        ->getCacheTimeout());
    }
  }
}