Skip to content

Commit

Permalink
xrdsut: add pure getter in XrdSutCache
Browse files Browse the repository at this point in the history
Does not create the entry if not existing.
Used by XrdCryptosslX509Crl.
  • Loading branch information
gganis committed Jul 6, 2017
1 parent eb092ea commit db73662
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/XrdSut/XrdSutCache.hh
Expand Up @@ -51,6 +51,31 @@ public:
XrdSutCache(int psize = 89, int size = 144, int load = 80) : table(psize, size, load) {}
virtual ~XrdSutCache() {}

XrdSutCacheEntry *Get(const char *tag) {
// Get the entry with 'tag'.
// If found the entry is returned rd-locked.
// If rd-locking fails the status is set to kCE_inactive.
// Returns null if not found.

XrdSutCacheEntry *cent = 0;

// Exclusive access to the table
XrdSysMutexHelper raii(mtx);

// Look for an entry
if (!(cent = table.Find(tag))) {
// none found
return cent;
}

// We found an existing entry:
// lock until we get the ability to read (another thread may be valudating it)
if (cent->rwmtx.ReadLock()) {
// A problem occured: fail (set the entry invalid)
cent->status = kCE_inactive;
}
return cent;
}

XrdSutCacheEntry *Get(const char *tag, bool &rdlock, XrdSutCacheGet_t condition = 0, void *arg = 0) {
// Get or create the entry with 'tag'.
Expand Down

0 comments on commit db73662

Please sign in to comment.