Problem/Motivation

When opening layout builder, the restrictions check for each block if the user's role have permission to access this.
This calls getBlockTypeByUuid for each block available. This function does a DB call, which i saw being run 2000+ times in a project.
In this case i think it's because content blocks are also used and checked.

Steps to reproduce

Find a site where loading layout builders take long.

Proposed resolution

We can cache this function, so the DB query does not run 2K times.

Remaining tasks

Check if we can refactor things here to stop calling this method 2K times.

CommentFileSizeAuthor
#2 cache-get-block-type-uuid.patch2 KBmallezie

Comments

mallezie created an issue. See original summary.

mallezie’s picture

Status: Active » Needs review
StatusFileSize
new2 KB

This patch caches the getBlockTypeByUuid function in a memory cache.

  • nginex committed d1552306 on 1.0.x
    Issue #3322896: Cache getBlockTypeByUuid
    
nginex’s picture

Status: Needs review » Fixed
nginex’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.